SHOW SINGLE TABLES 语法用于查询指定逻辑库中的单表。
ShowSingleTables ::=
'SHOW' 'SINGLE' 'TABLES' ('FROM' databaseName)? showLike?
showLike ::=
'LIKE' likePattern
likePattern ::=
string
databaseName ::=
identifier
databaseName 时,默认是当前使用的 DATABASE。 如果也未使用 DATABASE 则会提示 No database selected。| 列 | 说明 |
|---|---|
| table_name | 单表名称 |
| storage_unit_name | 单表所在的数据源名称 |
| schema_name | Schema 名称,仅在存在 Schema 元数据时返回 |
SHOW SINGLE TABLES FROM sharding_db;
mysql> SHOW SINGLE TABLES FROM sharding_db;
+------------+-------------------+
| table_name | storage_unit_name |
+------------+-------------------+
| t_user | ds_0 |
+------------+-------------------+
1 row in set (0.00 sec)
SHOW SINGLE TABLES;
mysql> SHOW SINGLE TABLES;
+------------+-------------------+
| table_name | storage_unit_name |
+------------+-------------------+
| t_user | ds_0 |
+------------+-------------------+
1 row in set (0.00 sec)
order_5 结尾的单表SHOW SINGLE TABLES FROM sharding_db LIKE '%order_5';
mysql> SHOW SINGLE TABLES FROM sharding_db LIKE '%order_5';
+------------+-------------------+
| table_name | storage_unit_name |
+------------+-------------------+
| t_order_5 | ds_1 |
+------------+-------------------+
1 row in set (0.11 sec)
order_5 结尾的单表SHOW SINGLE TABLES LIKE '%order_5';
mysql> SHOW SINGLE TABLES LIKE '%order_5';
+------------+-------------------+
| table_name | storage_unit_name |
+------------+-------------------+
| t_order_5 | ds_1 |
+------------+-------------------+
1 row in set (0.11 sec)
SHOW、SINGLE、TABLE、TABLES、LIKE、FROM
