updating existing sql database | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

updating existing sql database

Hi, I have a problem, I have created a database with 20 tables now I want to add this add id_ INT(11) NOT NULL AUTO_INCREMENT into my existing tables, how do I go about it? can someone help me with the correct syntax, the table name is "carmodels"?

22nd Oct 2019, 7:38 AM
Letlhohonolo Tepanyeka
Letlhohonolo Tepanyeka - avatar
2 Answers
+ 3
ALTER TABLE carmodels ADD id_ INT(11) PRIMARY KEY AUTO_INCREMENT make sure there is no any other primary key column.
22nd Oct 2019, 8:01 AM
A͢J
A͢J - avatar
0
AJ thanks, but it keeps on returning syntax error
22nd Oct 2019, 8:07 AM
Letlhohonolo Tepanyeka
Letlhohonolo Tepanyeka - avatar