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)/
IF NOT EXISTS
Updated on 2024-07-19 GMT+08:00
IF NOT EXISTS
DSC supports the conversion of IF NOT EXISTS, which is reserved during the migration.
Input
1 2 3 4 5 6 7 8 9 10 |
DROP TABLE IF EXISTS `categories`; CREATE TABLE IF NOT EXISTS `categories` ( `CategoryID` tinyint(5) unsigned NOT NULL PRIMARY KEY AUTO_INCREMENT, `CategoryName` varchar(15) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL DEFAULT '' , `Description` mediumtext CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL , `Picture` varchar(50) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL DEFAULT '', UNIQUE (`CategoryID`) )ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=latin1; DROP TABLE IF EXISTS `categories`; |
Output
1 2 3 4 5 6 7 8 |
DROP TABLE IF EXISTS "public"."categories"; CREATE TABLE IF NOT EXISTS "public"."categories" ( "categoryid" SMALLSERIAL NOT NULL PRIMARY KEY, "categoryname" VARCHAR(60) NOT NULL DEFAULT '', "description" TEXT NOT NULL, "picture" VARCHAR(200) NOT NULL DEFAULT '' ) WITH (ORIENTATION = ROW, COMPRESSION = NO) NOCOMPRESS DISTRIBUTE BY HASH ("categoryid"); DROP TABLE IF EXISTS "public"."categories"; |
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