Sequences are used for on demand unique value generation as integers 1,2,3,4… in some databases as many applications requires each row in a table contain unique value .
Sequences can be in ascending order or descending order and generated at a defined intervals and they restart from top when exceed a maximum value.
CREATE SEQUENCE sequence_name
START WITH first_value
INCREMENT BY increment_value
MINVALUE minimum value
MAXVALUE maximum value
CREATE SEQUENCE seq_1
start with 1
increment by 2
This will create a sequence name ‘seq_1’ which will start from 1 and incremented by 2 until it reaches 50 and once it will exceed it will repeat from beginning with 1.
Learn more : SQL Tutorial , SQL Interview Questions