SHOW SHARDING TABLE REFERENCE RULE

Description

SHOW SHARDING TABLE REFERENCE RULE syntax is used to query specified sharding table reference rule in the specified logical database.

Syntax

Grammar Railroad diagram

  1. ShowShardingBindingTableRules::=
  2. 'SHOW' 'SHARDING' 'TABLE' 'REFERENCE' ('RULE' ruleName | 'RULES') ('FROM' databaseName)?
  3. ruleName ::=
  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

ColumnsDescriptions
nameSharding table reference rule name
sharding_table_referencesharding table reference

Example

  • Query sharding table reference rules for the specified logical database
  1. SHOW SHARDING TABLE REFERENCE RULES FROM sharding_db;
  1. mysql> SHOW SHARDING TABLE REFERENCE RULES FROM sharding_db;
  2. +-------+--------------------------+
  3. | name | sharding_table_reference |
  4. +-------+--------------------------+
  5. | ref_0 | t_a,t_b |
  6. | ref_1 | t_c,t_d |
  7. +-------+--------------------------+
  8. 2 rows in set (0.00 sec)
  • Query sharding table reference rules for the current logical database
  1. SHOW SHARDING TABLE REFERENCE RULES;
  1. mysql> SHOW SHARDING TABLE REFERENCE RULES;
  2. +-------+--------------------------+
  3. | name | sharding_table_reference |
  4. +-------+--------------------------+
  5. | ref_0 | t_a,t_b |
  6. | ref_1 | t_c,t_d |
  7. +-------+--------------------------+
  8. 2 rows in set (0.00 sec)
  • Query specified sharding table reference rule for the specified logical database
  1. SHOW SHARDING TABLE REFERENCE RULE ref_0 FROM sharding_db;
  1. mysql> SHOW SHARDING TABLE REFERENCE RULE FROM sharding_db;
  2. +-------+--------------------------+
  3. | name | sharding_table_reference |
  4. +-------+--------------------------+
  5. | ref_0 | t_a,t_b |
  6. +-------+--------------------------+
  7. 1 row in set (0.00 sec)
  • Query specified sharding table reference rule for the current logical database
  1. SHOW SHARDING TABLE REFERENCE RULE ref_0;
  1. mysql> SHOW SHARDING TABLE REFERENCE RULE ref_0;
  2. +-------+--------------------------+
  3. | name | sharding_table_reference |
  4. +-------+--------------------------+
  5. | ref_0 | t_a,t_b |
  6. +-------+--------------------------+
  7. 1 row in set (0.00 sec)

Reserved word

SHOW, SHARDING, TABLE, REFERENCE, RULE, RULES, FROM