Skip to content
NEW

Introducing SurrealDB Studio, the new official app of SurrealDB

Learn more

1/5

Course content preview

14: Schemafull and schemaless

Our database now has two schemaless tables.

INFO FOR DB;


Response
{
  accesses: {},
  analyzers: {},
  configs: {},
  functions: {},
  models: {},
  params: {},
  tables: {
    place: 'DEFINE TABLE place TYPE ANY SCHEMALESS PERMISSIONS NONE',
    town: 'DEFINE TABLE town TYPE ANY SCHEMALESS PERMISSIONS NONE'
  },
  users: {}
}


Schemaless means that the table is free to accept any sort of data that we give it. If the tables were SCHEMAFULL, they would have been much stricter. A schemafull table will ignore input for any field except id unless it is defined in advance.

DEFINE TABLE schemafull_town SCHEMAFULL;
-- schemafull_town only has one defined field
DEFINE FIELD population ON schemafull_town TYPE number;

-- So the query succeeds, but 'name' data is ignored
CREATE schemafull_town SET name = "Riverdale", population = 75000;
REMOVE TABLE schemafull_town;


CREATE query output
[
  {
    id: schemafull_town:q9olode057qz1vdzruuv,
    population: 75000
  }
]


The INFO FOR command works for other items too, like tables.

INFO FOR TABLE place;
INFO FOR TABLE town;


Response
-------- Query --------

{
  events: {},
  fields: {},
  indexes: {},
  lives: {},
  tables: {}
}

-------- Query --------

{
  events: {},
  fields: {},
  indexes: {},
  lives: {},
  tables: {}
}


The empty output shows that place and town are schemaless, without any defined fields. That means that we could create a town whose name is a completely different type, like a number.

CREATE town SET name = 9999.999999;


Response
[
  {
    id: town:x1hy1y4d21x5dlhndprc,
    name: 9999.999999f
  }
]


We don't want people to create towns with names like 9999.999999, so we will create a schema on the next page to ensure that this won't happen. Let's first delete this unwanted town.

DELETE town WHERE name = 9999.999999 RETURN BEFORE;


Response
[
  {
    id: town:2ciozta7zj7b8yvqfkpm,
    name: 9999.999999f
  }
]


Previous

13: Viewing the database as a whole

Next lesson

15: Viewing the schema

SurrealDB

The unified data layer for AI

Graph, vector, document, and relational in one engine.
Agent Memory that connects and retrieves context wherever your data lives.

Explore with AI

Stay in the loop

Tutorials, AI agent recipes, and product updates, every two weeks.

Independently verified

SOC 2 Type 2

GDPR

Cyber Essentials Plus

ISO 27001

Trust Centre

Copyright © 2026 SurrealDB Ltd. Registered in England and Wales. Company no. 13615201

Registered address: 3rd Floor 1 Ashley Road, Altrincham, Cheshire, WA14 2DT, United Kingdom

Trading address: Huckletree Oxford Circus, 213 Oxford Street, London, W1D 2LG, United Kingdom