CREATE SHARDING BROADCAST TABLE RULE
语法用于为需要广播的表(广播表)创建广播规则
CreateDefaultShardingStrategy ::=
'CREATE' 'DEFAULT' 'SHARDING' ('DATABASE' | 'TABLE') 'STRATEGY' '(' shardingStrategy ')'
shardingStrategy ::=
'TYPE' '=' strategyType ',' ( 'SHARDING_COLUMN' '=' columnName | 'SHARDING_COLUMNS' '=' columnNames ) ',' ( 'SHARDING_ALGORITHM' '=' algorithmName | algorithmDefinition )
algorithmDefinition ::=
'TYPE' '(' 'NAME' '=' algorithmType ( ',' 'PROPERTIES' '(' propertyDefinition ')' )?')'
columnNames ::=
columnName (',' columnName)+
columnName ::=
identifier
algorithmName ::=
identifier
algorithmType ::=
identifier
tableName
可使用已经存在的表或者将要创建的表;CREATE SHARDING BROADCAST TABLE RULE
。
当广播规则已经存在但还需要添加广播表时,需要使用 ALTER BROADCAST TABLE RULE
来修改广播规则。-- 将 t_province, t_city 添加到广播规则中
CREATE SHARDING BROADCAST TABLE RULES (t_province, t_city);
CREATE
、SHARDING
、BROADCAST
、TABLE
、RULES