Tag Info

About

An attribute of an integer column in a table which allows a Database Server Process to automatically generate a new sequence number every time a new row is created.

You define it in MySQL with

id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,

You define it in MS SQL Server

id INT PRIMARY KEY IDENTITY,

Oracle has a mechanized object called a SEQUENCE

You would create the SEQUENCE object first

CREATE SEQUENCE mysequence
MINVALUE 1
START WITH 1
INCREMENT BY 1
CACHE 10;

Then, you call for the next value attribute of the SEQUENCE like this:

INSERT INTO mytable (id,column1,column2, ...)
VALUES (mysequence.nextval,'value1','value2', ...)l
history | show excerpt | excerpt history