postgreSQL 的基本使用

自增长id

-- 方法一 --
-- admin_id_seq 自定义名称 --
CREATE SEQUENCE admin_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
alter table admin alter column id set default nextval('admin_id_seq');

-- 方法二 --
CREATE TABLE customers  
(
  id SERIAL primary key ,
  name character varying,
  address character varying,
  phone character varying,
  country character varying
)

1,884 total views, 4 views today

Revisions

There are no revisions for this post.

No comments yet.

发表评论