LET
statement
A parameter can store any value, including the result of a query.
Statement syntax
SurrealQL SyntaxLET $@parameter = @value;
Example usage
The following query shows example usage of this statement.
-- Define the parameter
LET $name = "tobie";
-- Use the parameter
CREATE person SET name = $name;
The following query shows the LET
statement being used to store the result of a subquery.
-- Define the parameter
LET $adults = (SELECT * FROM person WHERE age > 18);
-- Use the parameter
UPDATE $adults SET adult = true;