SHOW SINGLE TABLES
Description
The SHOW SINGLE TABLES syntax is used to query single tables for specified database.
Syntax
ShowSingleTables ::=
'SHOW' 'SINGLE' 'TABLES' ('FROM' databaseName)? showLike?
showLike ::=
'LIKE' likePattern
likePattern ::=
string
databaseName ::=
identifierSupplement
- When
databaseNameis not specified, the default is the currently usedDATABASE. IfDATABASEis not used,No database selectedwill be prompted.
Return value description
| Column | Description |
|---|---|
| table_name | Single table name |
| storage_unit_name | The storage unit name where the single table is located |
| schema_name | Schema name, returned only when schema metadata exists |
Example
- Query single tables for specified database.
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)- Query single tables for current database.
SHOW SINGLE TABLES;mysql> SHOW SINGLE TABLES;
+------------+-------------------+
| table_name | storage_unit_name |
+------------+-------------------+
| t_user | ds_0 |
+------------+-------------------+
1 row in set (0.00 sec)- Query the single tables whose table name end with
order_5for the specified logic database.
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)- Query the single tables whose table name end with
order_5for the current logic database
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)Reserved word
SHOW, SINGLE, TABLE, TABLES, LIKE, FROM