Click here to Skip to main content
15,891,529 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hello

i have create one table with one column as primary key, now i wanted to alter the column by adding the serialno/index column by auto_increment type in mysql by using the code
alter table tablename add columnname int auto_increment first,primarykey(columnname);
so is there any problem in having more than one primary key in a table

Please replay me

Regards
Ginnas
Posted

you cannot have more than one primary key instead you can keep both columns together as primary key
 
Share this answer
 
No! The clue is in the name "PrimaryKey".
Just as you can't have two "primary contact people", you can't have two "primary keys".
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900