Sequences in PostgreSQL
In this article, we will see how to use SEQUENCES in PostgreSQL.
SEQUENCE in postgreSQL creates a number generator. If We give a schema name then the sequence is created in the given schema. Otherwise it is created in the current schema. Temporary sequences stay in a special schema, so a schema name cannot be given when creating a temporary sequence.
Lets see SEQUENCES in PostgreSQL.
CREATE SEQUENCE serial START 101;
Lets see Using SEQUENCES in PostgreSQL example .
In above example, we created a table and "ID" column has a sequence, each insert it gets auto increment.