What difference between PRIMARY KEY and AUTO_INCREMENT PRIMARY KEY ? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

What difference between PRIMARY KEY and AUTO_INCREMENT PRIMARY KEY ?

full difference please

6th Jul 2016, 12:41 PM
Andrey
Andrey - avatar
3 Answers
+ 2
which field defined as primary key in a table, that field never contents duplicate value. Not even null value.It may AUTO_INCREMENT or not. And AUTO_INCREMENT keyword also never insert duplicate values but the main thing is this field value is increasing automatically +1, when new row inserted.No need to input value by user.
7th Jul 2016, 1:21 AM
Dipankar Banik
Dipankar Banik - avatar
+ 1
auto_increment is for adding +1 on every primary key record ex: my first record of column name is Jonh,the id Will be automaticaly 1, and for thé next record,for exemple Mike,the primary key column will be 1+1= 2,for thé next recirdy,3,4,...
16th Jul 2016, 2:20 PM
LISANGOLA BONDJALI CHRISTIAN
LISANGOLA BONDJALI CHRISTIAN - avatar
0
so primary key can be 1,2,4,5,6 but autoincrement primary key can be only as - 1,2,3,4,5,6 ?
7th Jul 2016, 6:48 AM
Andrey
Andrey - avatar