PostgreSQL/Sequence/Create Sequence — различия между версиями
Admin (обсуждение | вклад) м (1 версия) |
|
(нет различий)
|
Версия 13:45, 26 мая 2010
Create a sequence specifying the minvalue
postgres=#
postgres=# -- Creating a sequence
postgres=#
postgres=# CREATE SEQUENCE myseq MINVALUE 0;
CREATE SEQUENCE
postgres=#
postgres=# drop sequence myseq;
DROP SEQUENCE
postgres=#
postgres=#
Creation of a sequence
postgres=# -- Creation of a sequence
postgres=#
postgres=# CREATE SEQUENCE shipments_ship_id_seq START 200 INCREMENT 1;
CREATE SEQUENCE
postgres=#
postgres=# -- Select the next number from a sequence with the nextval() function:
postgres=#
postgres=# SELECT nextval ("shipments_ship_id_seq");
nextval
---------
200
(1 row)
postgres=#
postgres=#
postgres=# drop sequence shipments_ship_id_seq;
DROP SEQUENCE
postgres=#