Create Table with Autoincrement

How Can We Help?

You are here:
< Back

The important part is the IDENTITY(x,x) and PRIMARY KEY.

CREATE TABLE Persons (
    ID int IDENTITY(1,1) PRIMARY KEY,
    LastName varchar(255) NOT NULL,
    FirstName varchar(255),
    Age int
);

More information found here: https://www.w3schools.com/sql/sql_autoincrement.asp