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

后端 未结 14 1992
庸人自扰
庸人自扰 2020-11-21 06:50

I have a table:

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

Now I want to make the columns user

14条回答
  •  梦如初夏
    2020-11-21 07:27

    This works for mysql version 5.5.32

    ALTER TABLE  `tablename` ADD UNIQUE (`column1` ,`column2`);
    

提交回复
热议问题