postgresql 删除重复数据案例详解(post的用法搭配)居然可以这样

随心笔谈11个月前发布 admin
94 0



— —————————-
— Table structure for test
— —————————-
DROP TABLE IF EXISTS “public”.”test”;
CREATE TABLE “public”.”test” (
“id” int4 NOT NULL DEFAULT NULL,
“name” varchar(255) COLLATE “pg_catalog”.”default” DEFAULT NULL,
“age” int4 DEFAULT NULL
)
;

— —————————-
— Records of test
— —————————-
INSERT INTO “public”.”test” VALUES (1, ‘da’, 1);
INSERT INTO “public”.”test” VALUES (2, ‘da’, 12);
INSERT INTO “public”.”test” VALUES (3, ‘dd’, 80);
INSERT INTO “public”.”test” VALUES (4, ‘dd’, 80);
INSERT INTO “public”.”test” VALUES (5, ‘d1’, 13);

— —————————-
— Primary Key structure for table test
— —————————-
ALTER TABLE “public”.”test” ADD CONSTRAINT “test_pkey” PRIMARY KEY (“id”);

© 版权声明

相关文章