SQL to SurrealDB mapping
Quickly learn how to map your SQL knowledge to corresponding SurrealDB concepts and syntax.
Introduction
As a multi-model database, SurrealDB offers a lot of flexibility. Our SQL-like query language SurrealQL is a good example of this, where we often have more than one way to achieve the same result, depending on developer preference. In this mapping guide, we will focus on the syntax that most closely resembles the ANSI Structured Query Language (SQL).
Concepts mapping
For more in-depth explanations of SurrealDB concepts, see the concepts page.
Relational databases | SurrealDB |
---|---|
database | database |
table | table |
row | record |
column | field |
index | index |
primary key | record id |
transaction | transaction |
join | record links, embedding and graph relations |
Syntax mapping
Let's get you up to speed with SurrealQL syntax with some CRUD examples.
Create
As relational databases are schemafull, only the SurrealQL schemafull approach is shown below. For a schemaless option see the define table page.
For more SurrealQL examples, see the create and insert pages.
SQL | SurrealQL |
---|---|
|
|
|
|
|
|
Read
For more SurrealQL examples, see the select, live select and return pages.
SQL | SurrealQL |
---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Update
For more SurrealQL examples, see the update page.
SQL | SurrealQL |
---|---|
|
|
|
|
|
|
Delete
For more SurrealQL examples, see the delete and remove pages.
SQL | SurrealQL |
---|---|
|
|
|
|
|
|