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

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

    If You are creating table in mysql then use following :

    create table package_template_mapping (
    mapping_id  int(10) not null auto_increment  ,
    template_id int(10) NOT NULL ,
    package_id  int(10) NOT NULL ,
    remark      varchar(100),
    primary key (mapping_id) ,
    UNIQUE KEY template_fun_id (template_id , package_id)
    );
    

提交回复
热议问题