Update document

This commit is contained in:
Tuan Pham Anh 2024-09-10 10:24:31 +00:00
parent 0b7f28f75b
commit 561daee66f

View File

@ -46,13 +46,13 @@ Creates a table with the same structure as another table. You can specify a diff
### With a Schema and Data Cloned from Another Table ### With a Schema and Data Cloned from Another Table
``` sql ``` sql
CREATE TABLE [IF NOT EXISTS] [db.]table_name CLONE AS [db2.]name2 CREATE TABLE [IF NOT EXISTS] [db.]table_name CLONE AS [db2.]name2 [ENGINE = engine]
``` ```
Creates a table with the same structure as another table. After the new table is created, all partitions from `db2.name2` are attached to it. In other words, the data of `db2.name2` is cloned into `db.table_name` upon creation. This query is equivalent to the following: Creates a table with the same structure as another table. You can specify a different engine for the table. If the engine is not specified, the same engine will be used as for the `db2.name2` table. After the new table is created, all partitions from `db2.name2` are attached to it. In other words, the data of `db2.name2` is cloned into `db.table_name` upon creation. This query is equivalent to the following:
``` sql ``` sql
CREATE TABLE [IF NOT EXISTS] [db.]table_name AS [db2.]name2; CREATE TABLE [IF NOT EXISTS] [db.]table_name AS [db2.]name2 [ENGINE = engine];
ALTER TABLE [db.]table_name ATTACH PARTITION ALL FROM [db2].name2; ALTER TABLE [db.]table_name ATTACH PARTITION ALL FROM [db2].name2;
``` ```