forked from docs/doc-exports
Reviewed-by: Hasko, Vladimir <vladimir.hasko@t-systems.com> Reviewed-by: Pruthi, Vineet <vineet.pruthi@t-systems.com> Co-authored-by: Lu, Huayi <luhuayi@huawei.com> Co-committed-by: Lu, Huayi <luhuayi@huawei.com>
4.8 KiB
4.8 KiB
RENAME (Table Renaming)
The statement for renaming a table in MySQL is slightly different from that in GaussDB(DWS). DSC will perform adaptation based on GaussDB(DWS) features during migration.
- MySQL uses the RENAME TABLE statement to change a table name.
Input
# Rename a single table. RENAME TABLE DEPARTMENT TO NEWDEPT; # Rename multiple tables. RENAME TABLE NEWDEPT TO NEWDEPT_02,PEOPLE TO PEOPLE_02;
Output
-- Rename a single table. ALTER TABLE "public"."department" RENAME TO "newdept"; -- Rename multiple tables. ALTER TABLE "public"."newdept" RENAME TO "newdept_02"; ALTER TABLE "public"."people" RENAME TO "people_02";
- In MySQL, the ALTER TABLE RENAME statement is used to change a table name. When this statement is migrated by DSC, the keyword AS is converted to TO.
Input
## A. ALTER TABLE runoob_alter_test RENAME TO runoob_alter_testnew; ## B. ALTER TABLE runoob_alter_testnew RENAME AS runoob_alter_testnewnew;
Output
-- A. ALTER TABLE "public"."runoob_alter_test" RENAME TO "runoob_alter_testnew"; -- B. ALTER TABLE "public"."runoob_alter_testnew" RENAME TO "runoob_alter_testnewnew";
Parent topic: Table (Optional Parameters and Operations)