Is It Possible to have a primary key and auto increment key associated to two fields respectively?
Like wise, In a table there are 3 fields, say, ID, name and age..
Then is it possible that “ID is autoincrment key and name is primary key“?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
According to the MySQL documentation:
So as long as you satisfy those conditions, there’s no mention that it has to also be the primary key. So you should be able to have the primary key and a separate
AUTO_INCREMENTcolumn (though I’m not sure why you’d want to).