Equivalent of MSSQL IDENTITY Column in MySQL

Allan Chua picture Allan Chua · Apr 23, 2012 · Viewed 48.2k times · Source

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

Joe Stefanelli picture Joe Stefanelli · Apr 23, 2012
CREATE TABLE Lookups.Gender
(
    GenderID   INT         NOT NULL AUTO_INCREMENT,
    GenderName VARCHAR(32) NOT NULL
);