81536/how-specify-unique-constraint-for-multiple-columns-in-mysql
I have a table:
table votes ( id, user, email, address, primary key(id), );
Now I want to make the columns user, email, address unique (together).
How do I do this in MySql?
Hello @kartik,
Use this:
ALTER TABLE `votes` ADD UNIQUE `unique_index`(`user`, `email`, `address`);
Hope it helps!! Thank you!!
Hello @kartik, If you're using PDO, use PDO::lastInsertId. If you're ...READ MORE
Hello @kartik, Suppose, item_id is an integer identity column in items table ...READ MORE
Hello @kartik, We setup wildcard DNS like they ...READ MORE
Hello @kartik, Set posts_per_page parameter in args to ...READ MORE
Hey @kartik, First you have to go to ...READ MORE
Named route is used to give specific ...READ MORE
Hello, This is simple you just need to ...READ MORE
Hey @kartik, Named routing is another amazing feature of ...READ MORE
Hello @kartik, Try this: select * from information_schema.columns where table_schema ...READ MORE
Hello @kartik, Try: mysql -u username -p database_name < ...READ MORE
OR
At least 1 upper-case and 1 lower-case letter
Minimum 8 characters and Maximum 50 characters
Already have an account? Sign in.