luoyuxia commented on code in PR #23060:
URL: https://github.com/apache/flink/pull/23060#discussion_r1277438779
##########
docs/content/docs/dev/table/sql/create.md:
##########
@@ -557,6 +558,59 @@ INSERT INTO my_ctas_table SELECT id, name, age FROM
source_table WHERE mod(id, 1
{{< top >}}
+## [CREATE OR] REPLACE TABLE
+```sql
+[CREATE OR] REPLACE TABLE [catalog_name.][db_name.]table_name
+[COMMENT table_comment]
+WITH (key1=val1, key2=val2, ...)
+AS select_query
+```
+
+**Note** RTAS has the following semantic:
+* REPLACE TABLE AS SELECT statement: the target table to be replaced must
exist, otherwise, an exception will be thrown.
+* CREATE OR REPLACE TABLE AS SELECT statement: the target table to be replaced
will be created if it does not exist; if it does exist, it'll be replaced.
+
+Tables can also be replaced(or created) and populated by the results of a
query in one [CREATE OR] REPLACE TABLE(RTAS) statement. RTAS is the simplest
and fastest way to replace and insert data into a table with a single command.
Review Comment:
```suggestion
Tables can also be replaced(or created) and populated by the results of a
query in one [CREATE OR] REPLACE TABLE AS SELECT(RTAS) statement. RTAS is the
simplest and fastest way to replace(or create) and insert data into a table
with a single command.
```
##########
docs/content/docs/dev/table/sql/create.md:
##########
@@ -557,6 +558,59 @@ INSERT INTO my_ctas_table SELECT id, name, age FROM
source_table WHERE mod(id, 1
{{< top >}}
+## [CREATE OR] REPLACE TABLE
+```sql
+[CREATE OR] REPLACE TABLE [catalog_name.][db_name.]table_name
+[COMMENT table_comment]
+WITH (key1=val1, key2=val2, ...)
+AS select_query
+```
+
+**Note** RTAS has the following semantic:
+* REPLACE TABLE AS SELECT statement: the target table to be replaced must
exist, otherwise, an exception will be thrown.
+* CREATE OR REPLACE TABLE AS SELECT statement: the target table to be replaced
will be created if it does not exist; if it does exist, it'll be replaced.
+
+Tables can also be replaced(or created) and populated by the results of a
query in one [CREATE OR] REPLACE TABLE(RTAS) statement. RTAS is the simplest
and fastest way to replace and insert data into a table with a single command.
Review Comment:
nit: I'd like to remove `also`, for there's no context in here. It's not
like ctas part.'
```suggestion
Tables can be replaced(or created) and populated by the results of a query
in one [CREATE OR] REPLACE TABLE(RTAS) statement. RTAS is the simplest and
fastest way to replace and insert data into a table with a single command.
```
##########
docs/content.zh/docs/dev/table/sql/create.md:
##########
@@ -557,6 +558,58 @@ INSERT INTO my_ctas_table SELECT id, name, age FROM
source_table WHERE mod(id, 1
{{< top >}}
+## [CREATE OR] REPLACE TABLE
+```sql
+[CREATE OR] REPLACE TABLE [catalog_name.][db_name.]table_name
+[COMMENT table_comment]
+WITH (key1=val1, key2=val2, ...)
+AS select_query
+```
+
+**注意** RTAS 有如下语义:
+* REPLACE TABLE AS SELECT 语句:要被替换的目标表必须存在,否则会报错。
+* CREATE OR REPLACE TABLE AS SELECT 语句:要被替换的目标表如果不存在,引擎会自动创建;如果存在的话,引擎就直接替换它。
+
+表也可以通过一个 [CREATE OR] REPLACE TABLE(RTAS) 语句中的查询结果来替换(或创建)并填充数据,RTAS
是一种简单快捷的替换表并插入数据的方法。
Review Comment:
```suggestion
表可以通过一个 [CREATE OR] REPLACE TABLE(RTAS)语句中的查询结果来替换(或创建)并填充数据,RTAS
是一种简单快捷的替换表并插入数据的方法。
```
##########
docs/content.zh/docs/dev/table/sql/create.md:
##########
@@ -557,6 +558,58 @@ INSERT INTO my_ctas_table SELECT id, name, age FROM
source_table WHERE mod(id, 1
{{< top >}}
+## [CREATE OR] REPLACE TABLE
+```sql
+[CREATE OR] REPLACE TABLE [catalog_name.][db_name.]table_name
+[COMMENT table_comment]
+WITH (key1=val1, key2=val2, ...)
+AS select_query
+```
+
+**注意** RTAS 有如下语义:
+* REPLACE TABLE AS SELECT 语句:要被替换的目标表必须存在,否则会报错。
+* CREATE OR REPLACE TABLE AS SELECT 语句:要被替换的目标表如果不存在,引擎会自动创建;如果存在的话,引擎就直接替换它。
+
+表也可以通过一个 [CREATE OR] REPLACE TABLE(RTAS) 语句中的查询结果来替换(或创建)并填充数据,RTAS
是一种简单快捷的替换表并插入数据的方法。
Review Comment:
```suggestion
表可以通过一个 [CREATE OR] REPLACE TABLE(RTAS)语句中的查询结果来替换(或创建)并填充数据,RTAS
是一种简单快捷的替换表并插入数据的方法。
```
##########
docs/content.zh/docs/dev/table/sql/create.md:
##########
@@ -557,6 +558,58 @@ INSERT INTO my_ctas_table SELECT id, name, age FROM
source_table WHERE mod(id, 1
{{< top >}}
+## [CREATE OR] REPLACE TABLE
+```sql
+[CREATE OR] REPLACE TABLE [catalog_name.][db_name.]table_name
+[COMMENT table_comment]
+WITH (key1=val1, key2=val2, ...)
+AS select_query
+```
+
+**注意** RTAS 有如下语义:
+* REPLACE TABLE AS SELECT 语句:要被替换的目标表必须存在,否则会报错。
+* CREATE OR REPLACE TABLE AS SELECT 语句:要被替换的目标表如果不存在,引擎会自动创建;如果存在的话,引擎就直接替换它。
+
+表也可以通过一个 [CREATE OR] REPLACE TABLE(RTAS) 语句中的查询结果来替换(或创建)并填充数据,RTAS
是一种简单快捷的替换表并插入数据的方法。
Review Comment:
```suggestion
表也可以通过一个 [CREATE OR] REPLACE TABLE(RTAS)语句中的查询结果来替换(或创建)并填充数据,RTAS
是一种简单快捷的替换(或创建)表并插入数据的方法。
```
##########
docs/content.zh/docs/dev/table/sql/create.md:
##########
@@ -557,6 +558,58 @@ INSERT INTO my_ctas_table SELECT id, name, age FROM
source_table WHERE mod(id, 1
{{< top >}}
+## [CREATE OR] REPLACE TABLE
+```sql
+[CREATE OR] REPLACE TABLE [catalog_name.][db_name.]table_name
+[COMMENT table_comment]
+WITH (key1=val1, key2=val2, ...)
+AS select_query
+```
+
+**注意** RTAS 有如下语义:
+* REPLACE TABLE AS SELECT 语句:要被替换的目标表必须存在,否则会报错。
+* CREATE OR REPLACE TABLE AS SELECT 语句:要被替换的目标表如果不存在,引擎会自动创建;如果存在的话,引擎就直接替换它。
+
+表也可以通过一个 [CREATE OR] REPLACE TABLE(RTAS) 语句中的查询结果来替换(或创建)并填充数据,RTAS
是一种简单快捷的替换表并插入数据的方法。
Review Comment:
```suggestion
表也可以通过一个 [CREATE OR] REPLACE TABLE(RTAS)语句中的查询结果来替换(或创建)并填充数据,RTAS
是一种简单快捷的替换(或创建)表并插入数据的方法。
```
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]