USE
USE specifies the active database for your session. You can then perform operations, such as creating tables and executing queries.
Syntaxβ
USE [<catalog_name>.]<db_name>
Parametersβ
| Parameter | Required | Description |
|---|---|---|
| catalog_name | No | The catalog name.
|
| db_name | Yes | The database name. The database must exist. |
Examplesβ
Example 1: Use example_db from default_catalog as the active database of your session.
USE default_catalog.example_db;
Or
USE example_db;
Example 2: Use example_db from hive_catalog as the active database of your session.
USE hive_catalog.example_db;
Example 3: Switch the active database of your session from hive_catalog.example_table1 to iceberg_catalog.example_table2.
USE iceberg_catalog.example_table2;