mysql add auto increment and a additional key
- by Lee
Hey all
I am trying to alter a table with adding a new column setting it as auto increment and with a key.
The table already has one key and this one will be an addition. The error I get is the following.
error : Multiple primary key defined
My code is:
alter table user add column id int (11) NOT NULL AUTO_INCREMENT PRIMARY KEY FIRST;
I have also tries wrapping the key name ie
alter table user add column id int (11) NOT NULL AUTO_INCREMENT PRIMARY (id) KEY FIRST;
But still no luck.
How can it be done ?