How to add auto-increment while creating tables in MYSQL database?

 Posted by vishalneeraj-24503 on 3/6/2014 | Category: Sql Server Interview questions | Views: 613 | Points: 40
Answer:

We can use auto_increment while creating new table in MYSQL database.

Syntax:-
create table table_name(column_name1 int(5) not null auto_increment primary key,column_name2 varchar(50));

For Example:-
create table Employee_Master(Employee_Id int(5) not null auto_increment primary key,Employee_Name varchar(50));


Asked In: Many Interviews | Alert Moderator 

Comments or Responses

Login to post response