SurrealQL is SurrealDB's query language. Syntax is broadly SQL-like, with extensions for nested fields, graph edges, record IDs, and other SurrealDB-specific constructs.
For a guided introduction, see Learn: Querying.
Examples
A minimal query can follow a familiar SQL shape:
SELECT name,
metadata
FROM user
WHERE age >= 18; Projections can include nested objects and graph traversals:
SELECT name,
metadata.{
date_registered,
last_login
},
->wrote->post AS posts
FROM user
WHERE age >= 18;Further detail is organised under Statements and the other sections in this reference.
Clauses
Clauses - the clauses statements share, such as
WHERE,LIMIT,STARTandOMIT
Language primitives
Reference pages for the pieces a query is built from:
Statements - what a statement is, and how several combine into one query
Comments - the three comment forms SurrealQL accepts
Data types - every value type, from records to geometries
Operators - comparison, arithmetic, set and graph operators
Casting - converting a value from one type to another
Idioms - path syntax for reaching into records and graphs
Parameters - built-in parameters and your own
Formatters - formatting datetimes and numbers
Record links - pointing at another record
Record references - links the database keeps in step for you
Machine learning
ML functions - call a stored model from a query