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

后端 未结 14 1987
庸人自扰
庸人自扰 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:33

    You can add multiple-column unique indexes via phpMyAdmin. (I tested in version 4.0.4)

    Navigate to the structure page for your target table. Add a unique index to one of the columns. Expand the Indexes list on the bottom of the structure page to see the unique index you just added. Click the edit icon, and in the following dialog you can add additional columns to that unique index.

提交回复
热议问题