SCHEMATA

SCHEMATA 表提供数据库的相关信息。表数据等同于 SHOW DATABASES 语句的结果。

  1. USE INFORMATION_SCHEMA;
  2. DESC SCHEMATA;

结果如下:

  1. +----------------------------+--------+------+------+---------+---------------+
  2. | Column | Type | Key | Null | Default | Semantic Type |
  3. +----------------------------+--------+------+------+---------+---------------+
  4. | catalog_name | String | | NO | | FIELD |
  5. | schema_name | String | | NO | | FIELD |
  6. | default_character_set_name | String | | NO | | FIELD |
  7. | default_collation_name | String | | NO | | FIELD |
  8. | sql_path | String | | YES | | FIELD |
  9. +----------------------------+--------+------+------+---------+---------------+
  10. 5 rows in set (0.00 sec)
  1. SELECT * FROM SCHEMATA;
  1. +--------------+--------------------+----------------------------+------------------------+----------+
  2. | catalog_name | schema_name | default_character_set_name | default_collation_name | sql_path |
  3. +--------------+--------------------+----------------------------+------------------------+----------+
  4. | greptime | greptime_private | utf8 | utf8_bin | NULL |
  5. | greptime | information_schema | utf8 | utf8_bin | NULL |
  6. | greptime | public | utf8 | utf8_bin | NULL |
  7. +--------------+--------------------+----------------------------+------------------------+----------+
  8. 3 rows in set (0.01 sec)

SCHEMATA 表中的字段描述如下:

  • catalog_name:数据库所属的目录。
  • schema_name:数据库的名称。
  • default_character_set_name:数据库的默认字符集。
  • default_collation_name:数据库的默认排序规则。
  • sql_path:该项的值始终为 NULL