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

posted @ 2017-04-10 15:12  芒果君  阅读(11996)  评论(1编辑  收藏  举报