CREATE table SQL auto increment primary key

CREATE Table SQL statement cheat sheet with AUTO_INCREMENT column as primary key

SQL AUTO_INCREMENT Primary Key is used for generating a unique number automatically each time a new record is inserted into a table. Here is how to create a Table with AUTO_INCREMENT column as primary key.
CREATE TABLE Employee(
    employeeId int NOT NULL AUTO_INCREMENT,
    Name varchar(100) NOT NULL,
    Address varchar(100),
    Age int,
    Department varchar(100),
    PRIMARY KEY (employeeId)
);

No comments:

Post a Comment

NO JUNK, Please try to keep this clean and related to the topic at hand.
Comments are for users to ask questions, collaborate or improve on existing.