PostgreSQL 主键自动增长

建立主键并设置自动增加的办法好好几种,这里记录我测试过的:

 

drop table pro_process;
CREATE TABLE "public"."pro_process" (
"id" SERIAL primary key,  //设置主键并自动增长
"county_code" varchar(6) COLLATE "default" NOT NULL,
"county_name" varchar(50) COLLATE "default" NOT NULL,
"creator" varchar(100) COLLATE "default" NOT NULL,
"create_time" date NOT NULL
)
WITH (OIDS=FALSE)
;

ALTER TABLE "public"."pro_process" OWNER TO "postgres";

 

参考:

http://blog.csdn.net/dracotianlong/article/details/7946035

    原文作者:PostgreSQL
    原文地址: https://www.cnblogs.com/nextsummer/p/6689165.html
    本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系博主进行删除。
点赞