The CREATE SHARDING BINDING TABLE RULE
syntax is used to add binding relationships and create binding table rules for tables with sharding table rules
CreateBindingTableRule ::=
'CREATE' 'SHARDING' 'BINDING' 'TABLE' 'RULES' bindingTableDefinition (',' bindingTableDefinition )*
bindingTableDefinition ::=
'(' tableName (',' tableName)* ')'
tableName ::=
identifier
ds_${0..1}.t_order_${0..1}
与 ds_${0..1}.t_order_item_${0..1}
t_order_{order_id % 2}
and t_order_item_{order_item_id % 2}
CREATE SHARDING BINDING TABLE RULE
more than one time. When a binding table rule already exists but a binding relationship needs to be added, you need to use ALTER SHARDING BINDING TABLE RULE
to modify the binding table rule-- Before creating a binding table rule, you need to create sharding table rules t_order, t_order_item
CREATE SHARDING BINDING TABLE RULES (t_order,t_order_item);
-- Before creating binding table rules, you need to create sharding table rules t_order, t_order_item, t_product, t_product_item
CREATE SHARDING BINDING TABLE RULES (t_order,t_order_item),(t_product,t_product_item);