
2: Creating records
To create a library, we are going to need a record for it. A CREATE statement followed by a table name is all that we need to create a record.
But since our town is going to have all sorts of places, let's choose a more general table name: place. We can use the SET keyword to give this record a field called place_type so that we know a bit more about it.
[
{
id: place:dg96emq8s3rkaxpdrfq9,
place_type: 'library'
}
]Since we didn't give this place record an ID, SurrealDB will create a random one. Record IDs are composed of the table name, a : after the table name, and something else. If you don't choose an exact record ID, a random GUID (a Globally Unique Identifier) will be added after the : which gives an output like place:wrwfldojvfcyl9gbe5v3.
But you can choose your own record ID instead, like place:1 or place:my_library. Just make sure it hasn't already been used, because you can't create two records with the same ID.
[
{
id: place:my_library
}
]'Database record `place:my_library`
already exists'THE PLATFORM
Everything an application and its agents know. Five surfaces, one engine.
Database
Document, graph, vector, time-series and relational in one engine.

Agent Memory
What an agent learns, with its source and its time, in the same engine.

Cloud
Managed clusters in the regions you choose, scaled on demand.

Studio
Query, explore and design the schema from the browser.

MCP
Every model that speaks MCP reaches the database and the memory directly.

IN PRODUCTION
Trusted at scale. Samsung, Nvidia, Verizon, Tencent, and Walmart run on SurrealDB.
14,000+
Developers building on SurrealDB Cloud
4M+
Developers building on SurrealDB worldwide
FROM THE TEAMS
SurrealDB gives us a foundation where we can unify semantic search, knowledge graphs, and AI-driven decision making without stitching together multiple systems. Collapsing responsibility into SurrealDB has become our default engineering posture.
VP of Engineering, Later