Skip to main content

USE

Description​

The USE command allows us to switch to a specific database or compute group in your SQL environment.

Syntax​

USE { [catalog_name.]database_name[@compute_group_name] | @compute_group_name }

Example​

  1. If the demo database exists in current catalog, try accessing it:

    mysql> use demo;
    Database changed
  2. If the demo database exists in catalog hms_catalog, try switching the catalog and accessing it:

    mysql> use hms_catalog.demo;
    Database changed
  3. If the demo database exists in current catalog and you want to use the compute group named 'cg1', try accessing it:

    mysql> use demo@cg1;
    Database changed
  4. If you want to use only the compute group named 'cg1', try accessing it:

    mysql> use @cg1;
    Database changed

Relate Commands​

Keywords​

USE, DATABASE, USER, COMPUTE GROUP