The SHOW SINGLE TABLE
syntax is used to query single tables for specified database.
ShowSingleTable::=
'SHOW' 'SINGLE' ('TABLES' ('LIKES' likeLiteral)?|'TABLE' tableName) ('FROM' databaseName)?
tableName ::=
identifier
databaseName ::=
identifier
databaseName
is not specified, the default is the currently used DATABASE
. If DATABASE
is not used, No database selected
will be prompted.Column | Description |
---|---|
table_name | Single table name |
storage_unit_name | The storage unit name where the single table is located |
SHOW SINGLE TABLE t_user FROM sharding_db;
mysql> SHOW SINGLE TABLE t_user FROM sharding_db;
+------------+-------------------+
| table_name | storage_unit_name |
+------------+-------------------+
| t_user | ds_0 |
+------------+-------------------+
1 row in set (0.00 sec)
SHOW SINGLE TABLE t_user;
mysql> SHOW SINGLE TABLE t_user;
+------------+-------------------+
| table_name | storage_unit_name |
+------------+-------------------+
| t_user | ds_0 |
+------------+-------------------+
1 row in set (0.00 sec)
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
for the specified logic database.SHOW SINGLE TABLES LIKE '%order_5' FROM sharding_db;
mysql> SHOW SINGLE TABLES LIKE '%order_5' FROM sharding_db;
+------------+-------------------+
| table_name | storage_unit_name |
+------------+-------------------+
| t_order_5 | ds_1 |
+------------+-------------------+
1 row in set (0.11 sec)
order_5
for the current logic databaseSHOW 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