SHOW-DATABASES

Name

SHOW DATABASES

Description

该语句用于展示当前可见的 db

语法:

1. SHOW DATABASES [FROM catalog] [filter expr];

说明:

  1. SHOW DATABASES 会展示当前所有的数据库名称.
  2. SHOW DATABASES FROM catalog 会展示catalog中所有的数据库名称.
  3. SHOW DATABASES filter_expr 会展示当前所有经过过滤后的数据库名称.
  4. SHOW DATABASES FROM catalog filter_expr 这种语法不支持.

Example

  1. 展示当前所有的数据库名称.

1. SHOW DATABASES;

1. +--------------------+ 2. | Database | 3. +--------------------+ 4. | test | 5. | information_schema | 6. +--------------------+ 2. 会展示hms_catalog中所有的数据库名称.

1. SHOW DATABASES from hms_catalog;

1. +---------------+ 2. | Database | 3. +---------------+ 4. | default | 5. | tpch | 6. +---------------+ 3. 展示当前所有经过表示式like 'infor%'过滤后的数据库名称.

1. SHOW DATABASES like 'infor%';

1. +--------------------+ 2. | Database | 3. +--------------------+ 4. | information_schema | 5. +--------------------+

Keywords

1. SHOW, DATABASES

Best Practice