How do I specify unique constraint for multiple columns in MySQL? -


i have table:

table votes (     id,     user,     email,     address,     primary key(id), ); 

now want make columns user, email, address unique (together).

how do in mysql?

  • of course example just... example. please don't worry semantics.

alter table `votes` add unique `unique_index`(`user`, `email`, `address`); 

Comments

Popular posts from this blog

mysql - Dreamhost PyCharm Django Python 3 Launching a Site -

java - Sending SMS with SMSLib and Web Services -

python 3.5 - Pyqtgraph string in x tick -