How do I 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?
Thanks in advance.
- Of course the example is just... an example. So please don't worry about the semantics.
答:
alter table votes add unique index(user, email, address);