MySQL
Engine: InnoDB
I have a table, and I need two strings as primary key.
The reason for this is because I want ON DUPLICATE KEY UPDATE depended on those two strings.
How do I do that?
Ty in advance.
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.
You should not use them as primary keys. Use them as
UNIQUEindices instead, andON DUPLICATE KEY UPDATEwill still work. I would advise that you set your primary key to be a single integer type column that is completely independent of your data.Have a look at this example: http://sqlfiddle.com/#!2/41f2d/1