USE
statementThe USE
statement specifies a namespace and / or a database to use for the subsequent SurrealQL statements when switching between namespaces and databases. If you have a single namespace and database, you can define them in the sql command.
Ensure that your database and namespace exist and you have started your database before using the Sql command option.
SurrealQL SyntaxUSE [ NS @ns ] [ DB @db ];
The following query shows example usage of this statement if you have multiple namespaces and databases.
USE NS test; -- Switch to the 'test' Namespace
USE DB test; -- Switch to the 'test' Database
USE NS test DB test; -- Switch to the 'test' Namespace and 'test' Database
You can also use the INFO Statement to check the current namespace and database.
INFO FOR NS; -- Check the current Namespace
INFO FOR DB; -- Check the current Database