Used to switch to the specified database or compute group.
USE { [<catalog_name>.]<database_name>[@<compute_group_name>] | @<compute_group_name> }
Switch to the specified database.
1. <database_name>
The name of the database to switch to. If no catalog is specified, the current catalog is used by default.
Switch to the specified compute group only.
1. <compute_group_name>
The name of the compute group to switch to.
Switch to the specified database.
1. <catalog_name>
The name of the catalog to switch to.
2. <compute_group_name>
The name of the compute group to switch to.
| Privilege | Object | Notes |
|---|---|---|
| SELECT_PRIV | Catalog, Database | SELECT_PRIV privilege is required on the catalog or database to switch to. |
| USAGE_PRIV | Compute Group | USAGE_PRIV privilege is required on the compute group to switch to. |
If the demo database exists, try to use it:
use demo;
If the demo database exists under the hms_catalog catalog, try to switch to hms_catalog and use it:
use hms_catalog.demo;
If the demo database exists in the current catalog and you want to use the compute group named ‘cg1’, try to access it:
use demo@cg1;
If you only want to use the compute group named ‘cg1’, try to access it:
use @cg1;