Relational Table - Sequence

About

A sequence is a auxiliary relational data structure that maintains a sequence.

Relational sequences are generally used to generate automatically the value of a primary key with an incremental number.

Transparency usage

They may also be used transparently when a auto-increment instruction in SQL is given on a column

For example with SQlite:

CREATE TABLE foo (
  id INT autoincrement, 
  description TEXT
);

Query

Database may give you the possibility to query the actual or next value of a sequence.

Example with an Oracle sequence.

select my_sequence.nextval from dual;

Database implementation

  • IDENTITY in SQL Server
  • SEQUENCE/NEXTVAL in Oracle
  • AUTOINCREMENT in Access, SQlite

Powered by ComboStrap