ALTER table - adding AUTOINCREMENT in MySQL
I created a table in MySQL with on column itemID . After creating the table, now I want to change this column to AUTOINCREMENT . How can this be done using ALTER statements? Table definition: ALLITEMS (itemid int(10) unsigned, itemname varchar(50)) I am using the following code but it is throwing error: syntax incorrect . ALTER TABLE allitems MODIFY itemid INT(10) UNSIGNED AUTOINCREMENT; ThinkCode CREATE TABLE ALLITEMS( itemid INT(10)UNSIGNED, itemname VARCHAR(50) ); ALTER TABLE ALLITEMS CHANGE itemid itemid INT(10)AUTO_INCREMENT PRIMARY KEY; DESC ALLITEMS; INSERT INTO ALLITEMS(itemname)