postgresql设置主键自增的方法
小编给大家分享一下postgresql设置主键自增的方法,希望大家阅读完这篇文章后大所收获,下面让我们一起去探讨吧!
方法一:
CREATE TABLE customers ( customerid SERIAL primary key , companyname character varying, contactname character varying, phone character varying, country character varying )
方法二:
CREATE SEQUENCE event_id_seq START WITH 1 INCREMENT BY 1 NO MINVALUE NO MAXVALUE CACHE 1; alter table event alter column id set default nextval('event_id_seq');
看完了这篇文章,相信你对postgresql设置主键自增的方法有了一定的了解,想了解更多相关知识,欢迎关注行业资讯频道,感谢各位的阅读!