creating a sql table with id auto_increment | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

creating a sql table with id auto_increment

CREATE TABLE carmodels1 ( id INT(11) NOT NULL AUTO_INCREMENT, _year int(20), make varchar(20), country_of_origin varchar(20), nick_name varchar(30), color varchar(20) ); could someone fix this for me it returns an error saying "Error Code: 1075. Incorrect table definition; there can be only one auto column and it must be defined as a key

30th Oct 2019, 6:33 AM
Letlhohonolo Tepanyeka
Letlhohonolo Tepanyeka - avatar
2 Answers
+ 2
my guess (and it's a guess) is that id might also have to be declared as primary key.
30th Oct 2019, 8:00 AM
Nathan Stanley
Nathan Stanley - avatar
+ 1
Yes, thanks, I went through it and it is exactly what was missing
30th Oct 2019, 8:03 AM
Letlhohonolo Tepanyeka
Letlhohonolo Tepanyeka - avatar