[doc](fix) Improve the document example of alter table replace (#21958)

Improve the document example of alter table replace
The old doc example was wrong
This commit is contained in:
catpineapple
2023-07-28 10:21:47 +08:00
committed by GitHub
parent e87174dd6b
commit 313d4fd257
2 changed files with 26 additions and 6 deletions

View File

@ -67,12 +67,23 @@ If `swap` is `false`, do as follows:
### Example
1. Swap `tbl1` with `tbl2` without deleting the `tbl1` table
1. Atomic swap `tbl1` with `tbl2` without dropping any tables
```sql
ALTER TABLE tbl1 REPLACE WITH TABLE tbl2
[PROPERTIES('swap' = 'true')];
ALTER TABLE tbl1 REPLACE WITH TABLE tbl2;
```
or
```sql
ALTER TABLE tbl1 REPLACE WITH TABLE tbl2 PROPERTIES('swap' = 'true');
```
2. Atomic swap `tbl1` with `tbl2` and deleting the `tbl2` table(Keep `tbl1` and the data of the original `tbl2`)
```sql
ALTER TABLE tbl1 REPLACE WITH TABLE tbl2 PROPERTIES('swap' = 'false');
```
### Keywords

View File

@ -67,11 +67,20 @@ ALTER TABLE [db.]tbl1 REPLACE WITH TABLE tbl2
### Example
1.`tbl1``tbl2` 进行交换,不删除 `tbl1`
1.`tbl1``tbl2` 进行原子交换,不删除任何
```sql
ALTER TABLE tbl1 REPLACE WITH TABLE tbl2
[PROPERTIES('swap' = 'true')];
ALTER TABLE tbl1 REPLACE WITH TABLE tbl2;
```
```sql
ALTER TABLE tbl1 REPLACE WITH TABLE tbl2 PROPERTIES('swap' = 'true') ;
```
2.`tbl1``tbl2` 进行交换,删除 `tbl2` 表(保留名为`tbl1`,数据为`tbl2`的表)
```sql
ALTER TABLE tbl1 REPLACE WITH TABLE tbl2 PROPERTIES('swap' = 'false') ;
```
### Keywords