Help Center/
GaussDB(DWS)/
Tool Guide/
DSC/
SQL Syntax Migration Reference/
MySQL Syntax Migrating/
Schema Objects and Data Definition Language (DDL)/
Table (Optional Parameters and Operations)/
LIKE (Table Cloning)
Updated on 2024-07-19 GMT+08:00
LIKE (Table Cloning)
MySQL databases support CREATE TABLE. LIKE is a method with which a table is created by cloning the old table structure, It is also supported by GaussDB(DWS). DSC will add additional table attribute information during migration.
Input
1 2 3 4 5 6 7 8 |
CREATE TABLE IF NOT EXISTS `public`.`runoob_tbl_old`( `dataType_1` YEAR, `dataType_2` YEAR(4), `dataType_3` YEAR DEFAULT '2018', `dataType_4` TIME DEFAULT NULL ); CREATE TABLE `runoob_tbl` (like `runoob_tbl_old`); |
Output
1 2 3 4 5 6 7 8 9 10 11 12 13 |
CREATE TABLE IF NOT EXISTS "public"."runoob_tbl_old" ( "datatype_1" SMALLINT, "datatype_2" SMALLINT, "datatype_3" SMALLINT DEFAULT '2018', "datatype_4" TIME WITHOUT TIME ZONE DEFAULT NULL ) WITH ( ORIENTATION = ROW, COMPRESSION = NO ) NOCOMPRESS DISTRIBUTE BY HASH ("datatype_1"); CREATE TABLE "public"."runoob_tbl"( LIKE "public"."runoob_tbl_old" INCLUDING COMMENTS INCLUDING CONSTRAINTS INCLUDING DEFAULTS INCLUDING INDEXES INCLUDING STORAGE); |
Parent topic: Table (Optional Parameters and Operations)
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
The system is busy. Please try again later.
For any further questions, feel free to contact us through the chatbot.
Chatbot