为提高效率,提问时请提供以下信息,问题描述清晰可优先响应。
【DM版本】:
【操作系统】:
【CPU】:
【问题描述】*:
我创建一个表时候,如何在建表语句中,直接IF NOT EXISTS 这样不行,我需要怎么提前容错判断下
CREATE TABLE IF NOT EXISTS “VEHICLE”.“access_strategy_settings”
(“id” BIGINT NOT NULL,
“created” timestamp NULL DEFAULT NULL,
“updated” timestamp NULL DEFAULT NULL,
“deleted” timestamp NULL DEFAULT NULL,
“vehicle_id” varchar(255) NULL DEFAULT NULL,
“fp_count” INTEGER NULL DEFAULT NULL,
“fp_collect_time” INTEGER NULL DEFAULT NULL,
“fp_collect_bytes” INTEGER NULL DEFAULT NULL);
CREATE CLUSTER INDEX “pk_access_strategy_settings” ON “VEHICLE”.“access_strategy_settings”(“id”);
CREATE INDEX “index_access_strategy_settings_vehicle_id” ON “VEHICLE”.“access_strategy_settings”(“vehicle_id”);
需要开启兼容mysql模式
判断表存在就删除 drop table if exists table_name
不存在就创建 CREATE TABLE IF NOT EXISTS