From b35bb6acf011e9be1afb75522483c78fe9b1437c Mon Sep 17 00:00:00 2001 From: strongduanmu Date: Wed, 29 Jul 2020 22:26:58 +0800 Subject: [PATCH 1/3] add insert select statement doc --- docs/document/content/features/sharding/use-norms/sql.cn.md | 3 ++- docs/document/content/features/sharding/use-norms/sql.en.md | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/docs/document/content/features/sharding/use-norms/sql.cn.md b/docs/document/content/features/sharding/use-norms/sql.cn.md index bc0846252ea1f..c754f08710080 100644 --- a/docs/document/content/features/sharding/use-norms/sql.cn.md +++ b/docs/document/content/features/sharding/use-norms/sql.cn.md @@ -99,6 +99,7 @@ SELECT * FROM t_order WHERE to_date(create_time, 'yyyy-mm-dd') = '2019-01-01'; | INSERT INTO tbl_name (col1, col2,...) VALUES (?, ?, ....) | | | INSERT INTO tbl_name VALUES (?, ?,....) | | | INSERT INTO tbl_name (col1, col2, ...) VALUES (?, ?, ....), (?, ?, ....) | | +| INSERT INTO tbl_name (col1, col2, ...) SELECT col1, col2, ... FROM tbl_name WHERE col3 = ? | INSERT表和SELECT表必须为相同表或绑定表 | | UPDATE tbl_name SET col1 = ? WHERE col2 = ? | | | DELETE FROM tbl_name WHERE col1 = ? | | | CREATE TABLE tbl_name (col1 int, ...) | | @@ -117,7 +118,7 @@ SELECT * FROM t_order WHERE to_date(create_time, 'yyyy-mm-dd') = '2019-01-01'; | SQL | 不支持原因 | | ------------------------------------------------------------------------------------------ | -------------------------- | | INSERT INTO tbl_name (col1, col2, ...) VALUES(1+2, ?, ...) | VALUES语句不支持运算表达式 | -| INSERT INTO tbl_name (col1, col2, ...) SELECT col1, col2, ... FROM tbl_name WHERE col3 = ? | INSERT .. SELECT | +| INSERT INTO tbl_name (col1, col2, ...) SELECT * FROM tbl_name WHERE col3 = ? | SELECT子句暂不支持*号简写,暂不支持使用内置的分布式主键生成器 | | SELECT * FROM tbl_name1 UNION SELECT * FROM tbl_name2 | UNION | | SELECT * FROM tbl_name1 UNION ALL SELECT * FROM tbl_name2 | UNION ALL | | SELECT SUM(DISTINCT col1), SUM(col1) FROM tbl_name | 详见DISTINCT支持情况详细说明 | diff --git a/docs/document/content/features/sharding/use-norms/sql.en.md b/docs/document/content/features/sharding/use-norms/sql.en.md index d3225ecfc5b78..e104cc513dc79 100644 --- a/docs/document/content/features/sharding/use-norms/sql.en.md +++ b/docs/document/content/features/sharding/use-norms/sql.en.md @@ -99,6 +99,7 @@ When shardingColumn in expressions and functions, ShardingSphere will use full r | INSERT INTO tbl_name (col1, col2,...) VALUES (?, ?, ....) | | | INSERT INTO tbl_name VALUES (?, ?,....) | | | INSERT INTO tbl_name (col1, col2, ...) VALUES (?, ?, ....), (?, ?, ....) | | +| INSERT INTO tbl_name (col1, col2, ...) SELECT col1, col2, ... FROM tbl_name WHERE col3 = ? | The table inserted and the table selected must be the same or bind tables | | UPDATE tbl_name SET col1 = ? WHERE col2 = ? | | | DELETE FROM tbl_name WHERE col1 = ? | | | CREATE TABLE tbl_name (col1 int, ...) | | @@ -117,7 +118,7 @@ When shardingColumn in expressions and functions, ShardingSphere will use full r | SQL | Reason | | ------------------------------------------------------------------------------------------ | --------------------------------------------------- | | INSERT INTO tbl_name (col1, col2, ...) VALUES(1+2, ?, ...) | VALUES clause does not support operation expression | -| INSERT INTO tbl_name (col1, col2, ...) SELECT col1, col2, ... FROM tbl_name WHERE col3 = ? | INSERT .. SELECT | +| INSERT INTO tbl_name (col1, col2, ...) SELECT * FROM tbl_name WHERE col3 = ? | SELECT clause does not support *-shorthand and does not support built-in key generators | | SELECT * FROM tbl_name1 UNION SELECT * FROM tbl_name2 | UNION | | SELECT * FROM tbl_name1 UNION ALL SELECT * FROM tbl_name2 | UNION ALL | | SELECT SUM(DISTINCT col1), SUM(col1) FROM tbl_name | See DISTINCT availability detail | From 08b6dc9b762a57bb426d623485fb444aa6a90c17 Mon Sep 17 00:00:00 2001 From: strongduanmu Date: Wed, 29 Jul 2020 22:35:40 +0800 Subject: [PATCH 2/3] add replace select statement doc --- docs/document/content/features/sharding/use-norms/sql.cn.md | 2 ++ docs/document/content/features/sharding/use-norms/sql.en.md | 2 ++ 2 files changed, 4 insertions(+) diff --git a/docs/document/content/features/sharding/use-norms/sql.cn.md b/docs/document/content/features/sharding/use-norms/sql.cn.md index c754f08710080..90098b178c120 100644 --- a/docs/document/content/features/sharding/use-norms/sql.cn.md +++ b/docs/document/content/features/sharding/use-norms/sql.cn.md @@ -100,6 +100,7 @@ SELECT * FROM t_order WHERE to_date(create_time, 'yyyy-mm-dd') = '2019-01-01'; | INSERT INTO tbl_name VALUES (?, ?,....) | | | INSERT INTO tbl_name (col1, col2, ...) VALUES (?, ?, ....), (?, ?, ....) | | | INSERT INTO tbl_name (col1, col2, ...) SELECT col1, col2, ... FROM tbl_name WHERE col3 = ? | INSERT表和SELECT表必须为相同表或绑定表 | +| REPLACE INTO tbl_name (col1, col2, ...) SELECT col1, col2, ... FROM tbl_name WHERE col3 = ? | REPLACE表和SELECT表必须为相同表或绑定表 | | UPDATE tbl_name SET col1 = ? WHERE col2 = ? | | | DELETE FROM tbl_name WHERE col1 = ? | | | CREATE TABLE tbl_name (col1 int, ...) | | @@ -119,6 +120,7 @@ SELECT * FROM t_order WHERE to_date(create_time, 'yyyy-mm-dd') = '2019-01-01'; | ------------------------------------------------------------------------------------------ | -------------------------- | | INSERT INTO tbl_name (col1, col2, ...) VALUES(1+2, ?, ...) | VALUES语句不支持运算表达式 | | INSERT INTO tbl_name (col1, col2, ...) SELECT * FROM tbl_name WHERE col3 = ? | SELECT子句暂不支持*号简写,暂不支持使用内置的分布式主键生成器 | +| REPLACE INTO tbl_name (col1, col2, ...) SELECT * FROM tbl_name WHERE col3 = ? | SELECT子句暂不支持*号简写,暂不支持使用内置的分布式主键生成器 | | SELECT * FROM tbl_name1 UNION SELECT * FROM tbl_name2 | UNION | | SELECT * FROM tbl_name1 UNION ALL SELECT * FROM tbl_name2 | UNION ALL | | SELECT SUM(DISTINCT col1), SUM(col1) FROM tbl_name | 详见DISTINCT支持情况详细说明 | diff --git a/docs/document/content/features/sharding/use-norms/sql.en.md b/docs/document/content/features/sharding/use-norms/sql.en.md index e104cc513dc79..9b62c666fa323 100644 --- a/docs/document/content/features/sharding/use-norms/sql.en.md +++ b/docs/document/content/features/sharding/use-norms/sql.en.md @@ -100,6 +100,7 @@ When shardingColumn in expressions and functions, ShardingSphere will use full r | INSERT INTO tbl_name VALUES (?, ?,....) | | | INSERT INTO tbl_name (col1, col2, ...) VALUES (?, ?, ....), (?, ?, ....) | | | INSERT INTO tbl_name (col1, col2, ...) SELECT col1, col2, ... FROM tbl_name WHERE col3 = ? | The table inserted and the table selected must be the same or bind tables | +| REPLACE INTO tbl_name (col1, col2, ...) SELECT col1, col2, ... FROM tbl_name WHERE col3 = ? | The table replaced and the table selected must be the same or bind tables | | UPDATE tbl_name SET col1 = ? WHERE col2 = ? | | | DELETE FROM tbl_name WHERE col1 = ? | | | CREATE TABLE tbl_name (col1 int, ...) | | @@ -119,6 +120,7 @@ When shardingColumn in expressions and functions, ShardingSphere will use full r | ------------------------------------------------------------------------------------------ | --------------------------------------------------- | | INSERT INTO tbl_name (col1, col2, ...) VALUES(1+2, ?, ...) | VALUES clause does not support operation expression | | INSERT INTO tbl_name (col1, col2, ...) SELECT * FROM tbl_name WHERE col3 = ? | SELECT clause does not support *-shorthand and does not support built-in key generators | +| REPLACE INTO tbl_name (col1, col2, ...) SELECT * FROM tbl_name WHERE col3 = ? | SELECT clause does not support *-shorthand and does not support built-in key generators | | SELECT * FROM tbl_name1 UNION SELECT * FROM tbl_name2 | UNION | | SELECT * FROM tbl_name1 UNION ALL SELECT * FROM tbl_name2 | UNION ALL | | SELECT SUM(DISTINCT col1), SUM(col1) FROM tbl_name | See DISTINCT availability detail | From c7ec69f517104b0d1d67265768c49fdccefbeb08 Mon Sep 17 00:00:00 2001 From: strongduanmu Date: Thu, 30 Jul 2020 16:11:51 +0800 Subject: [PATCH 3/3] modify doc description --- docs/document/content/features/sharding/use-norms/sql.cn.md | 4 ++-- docs/document/content/features/sharding/use-norms/sql.en.md | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/document/content/features/sharding/use-norms/sql.cn.md b/docs/document/content/features/sharding/use-norms/sql.cn.md index 90098b178c120..ef9de86945ef0 100644 --- a/docs/document/content/features/sharding/use-norms/sql.cn.md +++ b/docs/document/content/features/sharding/use-norms/sql.cn.md @@ -119,8 +119,8 @@ SELECT * FROM t_order WHERE to_date(create_time, 'yyyy-mm-dd') = '2019-01-01'; | SQL | 不支持原因 | | ------------------------------------------------------------------------------------------ | -------------------------- | | INSERT INTO tbl_name (col1, col2, ...) VALUES(1+2, ?, ...) | VALUES语句不支持运算表达式 | -| INSERT INTO tbl_name (col1, col2, ...) SELECT * FROM tbl_name WHERE col3 = ? | SELECT子句暂不支持*号简写,暂不支持使用内置的分布式主键生成器 | -| REPLACE INTO tbl_name (col1, col2, ...) SELECT * FROM tbl_name WHERE col3 = ? | SELECT子句暂不支持*号简写,暂不支持使用内置的分布式主键生成器 | +| INSERT INTO tbl_name (col1, col2, ...) SELECT * FROM tbl_name WHERE col3 = ? | SELECT子句暂不支持使用*号简写及内置的分布式主键生成器 | +| REPLACE INTO tbl_name (col1, col2, ...) SELECT * FROM tbl_name WHERE col3 = ? | SELECT子句暂不支持使用*号简写及内置的分布式主键生成器 | | SELECT * FROM tbl_name1 UNION SELECT * FROM tbl_name2 | UNION | | SELECT * FROM tbl_name1 UNION ALL SELECT * FROM tbl_name2 | UNION ALL | | SELECT SUM(DISTINCT col1), SUM(col1) FROM tbl_name | 详见DISTINCT支持情况详细说明 | diff --git a/docs/document/content/features/sharding/use-norms/sql.en.md b/docs/document/content/features/sharding/use-norms/sql.en.md index 9b62c666fa323..119f6a56ac188 100644 --- a/docs/document/content/features/sharding/use-norms/sql.en.md +++ b/docs/document/content/features/sharding/use-norms/sql.en.md @@ -119,8 +119,8 @@ When shardingColumn in expressions and functions, ShardingSphere will use full r | SQL | Reason | | ------------------------------------------------------------------------------------------ | --------------------------------------------------- | | INSERT INTO tbl_name (col1, col2, ...) VALUES(1+2, ?, ...) | VALUES clause does not support operation expression | -| INSERT INTO tbl_name (col1, col2, ...) SELECT * FROM tbl_name WHERE col3 = ? | SELECT clause does not support *-shorthand and does not support built-in key generators | -| REPLACE INTO tbl_name (col1, col2, ...) SELECT * FROM tbl_name WHERE col3 = ? | SELECT clause does not support *-shorthand and does not support built-in key generators | +| INSERT INTO tbl_name (col1, col2, ...) SELECT * FROM tbl_name WHERE col3 = ? | SELECT clause does not support *-shorthand and built-in key generators | +| REPLACE INTO tbl_name (col1, col2, ...) SELECT * FROM tbl_name WHERE col3 = ? | SELECT clause does not support *-shorthand and built-in key generators | | SELECT * FROM tbl_name1 UNION SELECT * FROM tbl_name2 | UNION | | SELECT * FROM tbl_name1 UNION ALL SELECT * FROM tbl_name2 | UNION ALL | | SELECT SUM(DISTINCT col1), SUM(col1) FROM tbl_name | See DISTINCT availability detail |