SCHEMATA

The SCHEMATA table provides information about databases. The table data is equivalent to the result of the SHOW DATABASES statement.

  1. USE INFORMATION_SCHEMA;
  2. DESC SCHEMATA;

The output is as follows:

  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)

Fields in the SCHEMATA table are described as follows:

  • catalog_name: The catalog to which the database belongs.
  • schema_name: The name of the database.
  • default_character_set_name: The default character set of the database.
  • default_collation_name: The default collation of the database.
  • sql_path: The value of this item is always NULL.