Sequences in SQL are used to create the auto generated values which are normally integers that follows a sequence.

CREATE SEQUENCE [schema.]sequence_name
[ AS datatype ]
[ START WITH value ]
[ INCREMENT BY value ]
[ MINVALUE value | NO MINVALUE ]
[ MAXVALUE value | NO MAXVALUE ]
[ CYCLE | NO CYCLE ]
[ CACHE value | NO CACHE ];
AS datatype : It can be BIGINT, INT, TINYINT, SMALLINT, DECIMAL, or NUMERIC. If datatype is not specified, the sequence will default to a BIGINT datatype.
START WITH value : The starting value that the sequence returns intially.
INCREMENT BY value : It can be either a positive or negative value. If a positive value is specified, the sequence will be an ascending sequence of values. If a negative value is specified, the sequence will be a descending sequence of values.
MINVALUE value : The minimum value for the sequence
NO MINVALUE: It means that no minimum value is there for the sequence .
MAXVALUE value : The maximum value given for the sequence.
NO MAXVALUE : It means that there is no maximum value specified for the sequence.
CYCLE : It means that the sequence will start over once it has completed the sequence.
NO CYCLE : When sequence gets completed it will raise an error after that.
CACHE value : It caches the sequence numbers to minimize disk IO.
NO CACHE : It does not cache the sequence numbers.
CREATE SEQUENCE contacts_seq
AS BIGINT
START WITH 1
INCREMENT BY 1
MINVALUE 1
MAXVALUE 99999
NO CYCLE
CACHE 10;
0 Comment(s)