What is a sequence?
A sequence is a named object in a database that can be used to generate unique numbers.
A sequence may be byteint, smallint, integer, bigint. You can use sequence values wherever you would use numeric values. You can create, alter, and drop named sequences.
CREATE SEQUENCE sequence_name AS data_type [<options>];
where the options are the following:
> START WITH start_value
> INCREMENT BY increment_value
> NO MINVALUE | MINVALUE minimum_value
> NO MAXVALUE | MAXVALUE maximum_value
> NO CYCLE | CYCLE
Sequences do not support cross database access; you cannot obtain a sequence value from a sequence defined in a different database.
Default MINVALUE is 1
Default MAXVALUE is the max value possible in the datatype.
INCREMENT BY can take both positive and negative values
By default, sequences do not cycle.
Sequences have gaps because IBM Netezza caches sequence values on the host and SPUs for efficient operation.