USE

Name

USE

Description

The USE command allows us to use the database

grammar:

  1. USE <[CATALOG_NAME].DATABASE_NAME>

illustrate:

  1. USE CATALOG_NAME.DATABASE_NAME will switch the current catalog into CATALOG_NAME and then change the current database into DATABASE_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

Keywords

  1. USE

Best Practice