SHOW TABLE METADATA

    语法

    补充说明

    • 未指定 databaseName 时,默认是当前使用的 DATABASE。 如果也未使用 DATABASE 则会提示 No database selected
    • 查询指定逻辑库中多个表的元数据
    1. SHOW TABLE METADATA t_order, t_order_1 FROM sharding_db;
    1. mysql> SHOW TABLE METADATA t_order, t_order_1 FROM sharding_db;
    2. +-------------------+------------+--------+----------+
    3. | schema_name | table_name | type | name |
    4. +-------------------+------------+--------+----------+
    5. | sharding_db | t_order_1 | COLUMN | order_id |
    6. | sharding_db | t_order_1 | COLUMN | user_id |
    7. | sharding_db | t_order_1 | INDEX | PRIMARY |
    8. | sharding_db | t_order | COLUMN | order_id |
    9. | sharding_db | t_order | COLUMN | status |
    10. | sharding_db | t_order | INDEX | PRIMARY |
    11. +-------------------+------------+--------+----------+
    12. 8 rows in set (0.01 sec)
    • 查询指定逻辑库中单个表的元数据
    1. mysql> SHOW TABLE METADATA t_order FROM sharding_db;
    2. +-------------------+------------+--------+----------+
    3. | schema_name | table_name | type | name |
    4. +-------------------+------------+--------+----------+
    5. | sharding_db | t_order | COLUMN | order_id |
    6. | sharding_db | t_order | COLUMN | user_id |
    7. | sharding_db | t_order | COLUMN | status |
    8. | sharding_db | t_order | INDEX | PRIMARY |
    9. 4 rows in set (0.00 sec)
    • 查询当前逻辑库中多个表的元数据
    • 查询当前逻辑库中单个表的元数据
    1. SHOW TABLE METADATA t_order;
    1. mysql> SHOW TABLE METADATA t_order;
    2. +-------------------+------------+--------+----------+
    3. | schema_name | table_name | type | name |
    4. +-------------------+------------+--------+----------+
    5. | sharding_db | t_order | COLUMN | order_id |
    6. | sharding_db | t_order | COLUMN | user_id |
    7. | sharding_db | t_order | COLUMN | status |
    8. | sharding_db | t_order | INDEX | PRIMARY |
    9. +-------------------+------------+--------+----------+
    10. 4 rows in set (0.01 sec)

    保留字