The CREATE SHARDING TABLE REFERENCE RULE
syntax is used to create reference rule for sharding tables
CreateShardingTableReferenceRule ::=
'CREATE' 'SHARDING' 'TABLE' 'REFERENCE' 'RULE' referenceRelationshipDefinition (',' referenceRelationshipDefinition )*
referenceRelationshipDefinition ::=
ruleName '(' tableName (',' tableName)* ')'
tableName ::=
identifier
ds_${0..1}.t_order_${0..1}
and ds_${0..1}.t_order_item_${0..1}
;t_order_{order_id % 2}
and t_order_item_{order_item_id % 2}
;-- Before creating a sharding table reference rule, you need to create sharding table rules t_order, t_order_item
CREATE SHARDING TABLE REFERENCE RULE ref_0 (t_order,t_order_item);
-- Before creating sharding table reference rules, you need to create sharding table rules t_order, t_order_item, t_product, t_product_item
CREATE SHARDING TABLE REFERENCE RULE ref_0 (t_order,t_order_item), ref_1 (t_product,t_product_item);
CREATE
, SHARDING
, TABLE
, REFERENCE
, RULE