更新时间:2024-10-26 GMT+08:00

DROP删除表

GaussDB(DWS)与MySQL都支持使用DROP语句删除表,但GaussDB(DWS)不支持在DROP语句中使用RESTRICT | CASCADE关键字。DSC工具迁移时会将上述关键字移除。

输入示例

1
2
3
4
5
6
7
CREATE TABLE IF NOT EXISTS `public`.`express_elb_server`(
   `runoob_id` VARCHAR(10),
   `runoob_title` VARCHAR(100) NOT NULL,
   `runoob_author` VARCHAR(40) NOT NULL,
   `submission_date` VARCHAR(10)
)ENGINE=InnoDB DEFAULT CHARSET=utf8;
DROP TABLE  `public`.`express_elb_server` RESTRICT;

输出示例

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
CREATE TABLE IF NOT EXISTS "public"."express_elb_server"
(
  "runoob_id" VARCHAR(40),
  "runoob_title" VARCHAR(400) NOT NULL,
  "runoob_author" VARCHAR(160) NOT NULL,
  "submission_date" VARCHAR(40)
)
  WITH ( ORIENTATION = ROW, COMPRESSION = NO )
  NOCOMPRESS
  DISTRIBUTE BY HASH ("runoob_id");
DROP TABLE "public"."express_elb_server";