How to make primary key auto increment using query | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How to make primary key auto increment using query

CREATE TABLE Persons ( ID int NOT NULL AUTO_INCREMENT, LastName varchar(255) NOT NULL, FirstName varchar(255), Address varchar(255), City varchar(255), PRIMARY KEY (ID) )

15th Oct 2016, 4:37 PM
Hiral
2 Answers
+ 2
above query is correct
16th Oct 2016, 10:39 AM
Rajesh Kumar
0
create table <table_name> (id INT AUTO_INCREMENT PRIMARY KEY ,first_name VARCHAR(255)); alternate syntax when we are not creating composite primary key.
16th Oct 2016, 8:35 PM
Anand Pol
Anand Pol - avatar