You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by GitBox <gi...@apache.org> on 2022/04/21 15:41:20 UTC

[GitHub] [shardingsphere] RaigorJiang commented on a diff in pull request #16979: Add `CREATE SHARDING BIDNING TABLE RULE` doc

RaigorJiang commented on code in PR #16979:
URL: https://github.com/apache/shardingsphere/pull/16979#discussion_r855328502


##########
docs/document/content/reference/distsql/syntax/rdl/rule-definition/sharding/create-sharding-binding-table-rule.cn.md:
##########
@@ -0,0 +1,39 @@
++++
+title = "CREATE SHARDING BINDING TABLE RULE"
+weight = 3
++++
+
+## 描述
+
+`CREATE SHARDING BINDING TABLE RULE` 语法用于为具有分片规则的表(分片表)添加绑定关系
+
+### 语法定义
+
+```SQL
+CreateBindingTableRule ::=
+  'CREATE' 'SHARDING' 'BINDING' 'TABLE' 'RULES' '(' tableName (',' tableName)* ')'
+
+tableName ::=
+  identifier
+```
+
+### 补充说明
+
+- 只有分片表才能创建绑定关系
+- 一个分片表只能具有一个绑定关系
+- 添加绑定关系的分片表需要使用相同的资源,并且分片节点个数相同。例如 `ds_${0..1}.t_order_${0..1}` 与 `ds_${0..1}.t_order_item_${0..1}`
+- 添加绑定关系的分片表需要对分片键使用相同的分片算法。例如 `t_order_${order_id % 2}` 与 `t_order_item_${order_item_id % 2}` 
+
+### 示例
+
+#### 创建绑定关系
+
+```sql
+-- 创建绑定关系之前需要先创建分片表 t_order,t_order_item
+CREATE SHARDING BINDING TABLE RULES (t_order,t_order_item);

Review Comment:
   How to create multiple groups of binding tables



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org