Logo
表组

表组 #

语法描述类型
CREATE SHARDING TABLE REFERENCE RULE创建分片表关联RDL
ALTER SHARDING TABLE REFERENCE RULE修改分片表关联RDL
DROP SHARDING TABLE REFERENCE RULE删除表关联RDL
SHOW SHARDING TABLE REFERENCE RULE查看表关联RQL

1. 创建分片表组 #

createShardingTableReferenceRule
    : CREATE SHARDING TABLE REFERENCE RULE ifNotExists? tableReferenceRuleDefinition (, tableReferenceRuleDefinition)*
    ;

tableReferenceRuleDefinition
    : ruleName ( tableName (, tableName)* )
    ;

ifNotExists
    : IF NOT EXISTS
    ;

示例

CREATE SHARDING TABLE REFERENCE RULE reference_0 (t_order,t_order_item), reference_1 (t_1,t_2);

2. 修改分片表组 #

alterShardingTableReferenceRule
    : ALTER SHARDING TABLE REFERENCE RULE ifNotExists? tableReferenceRuleDefinition (, tableReferenceRuleDefinition)*
    ;

tableReferenceRuleDefinition
    : ruleName ( tableName (, tableName)* )
    ;

ifNotExists
    : IF NOT EXISTS
    ;

示例

ALTER SHARDING TABLE REFERENCE RULE reference_0 (t_order,t_order_item), reference_1 (t_1,t_2);

3. 删除分片表组 #

dropShardingTableReferenceRule
    : DROP SHARDING TABLE REFERENCE RULE ifExists? ruleName (, ruleName)*
    ;

ifExists
    : IF EXISTS
    ;

示例

DROP SHARDING TABLE REFERENCE RULE reference_0;

4. 查看表组 #

showShardingTableReferenceRules
    : SHOW SHARDING TABLE REFERENCE (RULE ruleName | RULES) (FROM databaseName)?
    ;

示例

mysql> SHOW SHARDING TABLE REFERENCE RULE reference_0;
+-------------+--------------------------+
| name        | sharding_table_reference |
+-------------+--------------------------+
| reference_0 | t_order,t_order_item     |
+-------------+--------------------------+
1 rows in set (0.00 sec)

输出说明

说明
name表组名称
sharding_table_reference表组成员