SHOW TABLE METADATA
语法用于查询表的元数据
ShowTableMetadata ::=
'SHOW' 'TABLE' 'METADATA' tableName (',' tableName)* ('FROM' databaseName)?
tableName ::=
identifier
databaseName ::=
identifier
列 | 说明 |
---|---|
schema_name | 逻辑库名称 |
table_name | 表名称 |
type | 元数据类型 |
name | 元数据名称 |
databaseName
时,默认是当前使用的 DATABASE。
如果也未使用 DATABASE
则会提示 No database selected
。SHOW TABLE METADATA t_order, t_order_1 FROM test1;
mysql> SHOW TABLE METADATA t_order, t_order_1 FROM test1;
+-------------+------------+--------+----------+
| schema_name | table_name | type | name |
+-------------+------------+--------+----------+
| test1 | t_order_1 | COLUMN | order_id |
| test1 | t_order_1 | COLUMN | user_id |
| test1 | t_order_1 | COLUMN | status |
| test1 | t_order_1 | INDEX | PRIMARY |
| test1 | t_order | COLUMN | order_id |
| test1 | t_order | COLUMN | user_id |
| test1 | t_order | COLUMN | status |
| test1 | t_order | INDEX | PRIMARY |
+-------------+------------+--------+----------+
8 rows in set (0.01 sec)
SHOW TABLE METADATA t_order FROM test1;
mysql> SHOW TABLE METADATA t_order FROM test1;
+-------------+------------+--------+----------+
| schema_name | table_name | type | name |
+-------------+------------+--------+----------+
| test1 | t_order | COLUMN | order_id |
| test1 | t_order | COLUMN | user_id |
| test1 | t_order | COLUMN | status |
| test1 | t_order | INDEX | PRIMARY |
+-------------+------------+--------+----------+
4 rows in set (0.00 sec)
SHOW TABLE METADATA t_order, t_order_1;
mysql> SHOW TABLE METADATA t_order, t_order_1;
+-------------+------------+--------+----------+
| schema_name | table_name | type | name |
+-------------+------------+--------+----------+
| test1 | t_order_1 | COLUMN | order_id |
| test1 | t_order_1 | COLUMN | user_id |
| test1 | t_order_1 | COLUMN | status |
| test1 | t_order_1 | INDEX | PRIMARY |
| test1 | t_order | COLUMN | order_id |
| test1 | t_order | COLUMN | user_id |
| test1 | t_order | COLUMN | status |
| test1 | t_order | INDEX | PRIMARY |
+-------------+------------+--------+----------+
8 rows in set (0.00 sec)
SHOW TABLE METADATA t_order;
mysql> SHOW TABLE METADATA t_order;
+-------------+------------+--------+----------+
| schema_name | table_name | type | name |
+-------------+------------+--------+----------+
| test1 | t_order | COLUMN | order_id |
| test1 | t_order | COLUMN | user_id |
| test1 | t_order | COLUMN | status |
| test1 | t_order | INDEX | PRIMARY |
+-------------+------------+--------+----------+
4 rows in set (0.01 sec)
SHOW
、TABLE
、METADATA
、FROM