mysql 如何给表添加组合唯一索引

mysql 如何给表添加组合唯一索引

1 个解决方案

AllenJiang
中间件研发,关注微信公众号 : 小哈学Java, 回复"666", 即可免费领取10G学习&面试资料

有以下两种方式:

第一种:

alter table t_qms_answer_vote_user_rel add unique index qvv(`answer_id`, `vote_user_id`, `vote_operation_type`);

第二种:

alter table t_qms_answer_vote_user_rel add unique key qvv_key(`answer_id`, `vote_user_id`, `vote_operation_type`);