Allan Chua Allan Chua - 5 months ago 25
SQL Question

Equivalent of MSSQL IDENTITY Column in MySQL

What is the equivalent of MSSQL

IDENTITY
Columns in MySQL? How would I create this table in MySQL?

CREATE TABLE Lookups.Gender
(
GenderID INT IDENTITY(1,1) NOT NULL,
GenderName VARCHAR(32) NOT NULL
);

Answer
CREATE TABLE Lookups.Gender
(
    GenderID   INT         NOT NULL AUTO_INCREMENT,
    GenderName VARCHAR(32) NOT NULL
);