Description

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

Syntax

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

Example

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

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

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

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

    1. mysql> use @cg1;
    2. Database changed

Relate Commands

Keywords

  1. USE, DATABASE, USER, COMPUTE GROUP