Statements
SurrealDB has a large number of different SurrealQL statements for inserting, updating, deleting, working with graph data, and for configuring the database. View detailed information and examples on how to use each statement type below.
USE
statement
Used to switch to a different namespace or database
LET
statement
Used to set and store values which can be used in queries
BEGIN
statement
Used to mark the beginning of a group of statements in a transaction
CANCEL
statement
Used to cancel the execution of a group of statements within a transaction
COMMIT
statement
Used to apply a group of statements within a transaction to the database
IF ELSE
statement
Used to conditionally perform operations on the database
SELECT
statement
Used for selecting and querying data in a database
INSERT
statement
Used to insert or update data into the database
CREATE
statement
Used to add records to the database
UPDATE
statement
Used to update or modify records in the database
RELATE
statement
Used to generate graph edges between two records in the database
DELETE
statement
Used to delete records from the database
DEFINE
statement
Used to declare database rules, schemas, events and more
REMOVE
statement
Used to remove resources such as databases, tables, indexes, events and more
INFO
statement
Outputs information for a specified resource
SLEEP
statement
Delays or pauses in the execution of a query or a batch