You can use the USE syntax to change the current database if the current database is not the database in which you want to perform operations. After you change the current database, all subsequent operations are performed in the new current database.
Applicable engines and versions
The USE syntax is applicable to LindormTable and LindormTSDB. The USE syntax is supported by all versions of LindormTable and LindormTSDB.
Syntax
use_statement ::= USE { database_identifier | DEFAULT }
Parameters
After you use the USE syntax to change the current database, all subsequent operations such as table creation and data queries are performed in the new current database.
Destination database (database_identifier)
The database specified by the database_identifier parameter must exist in the instance. You can use the SHOW DATABASES
syntax to view all databases of the current instance. For more information about how to use the SHOW DATABASES
syntax, see SHOW DATABASES.
The default database (DEFAULT)
You can specify the DEFAULT keyword in the USE statement to change the current database to the default database. The name of the default database is default in LindormTable and LindormTSDB.
Examples
Change the current database to the default database.
USE DEFAULT;