postgresql如何让主键自增

  1. 
    法一:
    
    Sql代码  收藏代码
    CREATE TABLE customers
    (
    customerid SERIAL primary key ,
    companyname character varying,
    contactname character varying,
    phone character varying,
    country character varying
    )
    法二: Sql代码 收藏代码
    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');

      

上一篇:Flipping Parentheses~Gym 100803G


下一篇:解决SecureCRT连接linux终端中文显示乱码