Skip to content

Latest commit

 

History

History
18 lines (14 loc) · 444 Bytes

File metadata and controls

18 lines (14 loc) · 444 Bytes

AUTO INCREMENT Field

Auto-increment allows a unique number to be generated automatically when a new record is inserted into a table.

Syntax

CREATE TABLE Person (
    FirstName varchar(255) UNIQUE,
    LastName varchar(255) NOT NULL UNIQUE,
    Id int not null auto_increment
);

To let the AUTO_INCREMENT sequence start with another value, use the following SQL statement:

ALTER TABLE Person auto_increment=100;