SHOW SINGLE TABLE

Description

The SHOW SINGLE TABLE syntax is used to query single tables for specified database.

Syntax

Grammar Railroad diagram

  1. ShowSingleTable::=
  2. 'SHOW' 'SINGLE' ('TABLES' ('LIKES' likeLiteral)?|'TABLE' tableName) ('FROM' databaseName)?
  3. tableName ::=
  4. identifier
  5. databaseName ::=
  6. identifier

Supplement

  • When databaseName is not specified, the default is the currently used DATABASE. If DATABASE is not used, No database selected will be prompted.

Return value description

ColumnDescription
table_nameSingle table name
storage_unit_nameThe storage unit name where the single table is located

Example

  • Query specified single table for specified database.
  1. SHOW SINGLE TABLE t_user FROM sharding_db;
  1. mysql> SHOW SINGLE TABLE t_user FROM sharding_db;
  2. +------------+-------------------+
  3. | table_name | storage_unit_name |
  4. +------------+-------------------+
  5. | t_user | ds_0 |
  6. +------------+-------------------+
  7. 1 row in set (0.00 sec)
  • Query specified single table for current database.
  1. SHOW SINGLE TABLE t_user;
  1. mysql> SHOW SINGLE TABLE t_user;
  2. +------------+-------------------+
  3. | table_name | storage_unit_name |
  4. +------------+-------------------+
  5. | t_user | ds_0 |
  6. +------------+-------------------+
  7. 1 row in set (0.00 sec)
  • Query single tables for specified database.
  1. SHOW SINGLE TABLES FROM sharding_db;
  1. mysql> SHOW SINGLE TABLES FROM sharding_db;
  2. +------------+-------------------+
  3. | table_name | storage_unit_name |
  4. +------------+-------------------+
  5. | t_user | ds_0 |
  6. +------------+-------------------+
  7. 1 row in set (0.00 sec)
  • Query single tables for current database.
  1. SHOW SINGLE TABLES;
  1. mysql> SHOW SINGLE TABLES;
  2. +------------+-------------------+
  3. | table_name | storage_unit_name |
  4. +------------+-------------------+
  5. | t_user | ds_0 |
  6. +------------+-------------------+
  7. 1 row in set (0.00 sec)
  • Query the single tables whose table name end with order_5 for the specified logic database.
  1. SHOW SINGLE TABLES LIKE '%order_5' FROM sharding_db;
  1. mysql> SHOW SINGLE TABLES LIKE '%order_5' FROM sharding_db;
  2. +------------+-------------------+
  3. | table_name | storage_unit_name |
  4. +------------+-------------------+
  5. | t_order_5 | ds_1 |
  6. +------------+-------------------+
  7. 1 row in set (0.11 sec)
  • Query the single tables whose table name end with order_5 for the current logic database
  1. SHOW SINGLE TABLES LIKE '%order_5';
  1. mysql> SHOW SINGLE TABLES LIKE '%order_5';
  2. +------------+-------------------+
  3. | table_name | storage_unit_name |
  4. +------------+-------------------+
  5. | t_order_5 | ds_1 |
  6. +------------+-------------------+
  7. 1 row in set (0.11 sec)

Reserved word

SHOW, SINGLE, TABLE, TABLES, LIKE, FROM