postgresql如何设置主键自增
方法一:
CREATE TABLE customers(
customerid SERIAL primary key ,
companyname character varying,
contactname character varying,
phone character varying,
country character varying
)
方法二:
CREATE SEQUENCE event_id_seqSTART WITH 1
INCREMENT BY 1 NO MINVALUE NO MAXVALUE
CACHE 1;
alter table event alter column id set default nextval('event_id_seq');
Python学习网,大量的免费PostgreSQL入门教程,欢迎在线学习!
以上是 postgresql如何设置主键自增 的全部内容, 来源链接: utcz.com/z/538376.html