<table class="text">
<tr class="li1"><td class="ln"><pre class="de1">1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 sql Fiddle](http://sqlfiddle.com/) ``` create table `clip_test_unique_key` ( `id` int(11) NOT NULL AUTO_INCREMENT, `user_id` int(11) NOT NULL, `token` varchar(100) NOT NULL, PRIMARY KEY (`id`), UNIQUE KEY `token` (`token`), UNIQUE KEY `user_id_token` (`user_id`,`token`) ); insert into clip_test_unique_key values('1', '100', 'A'); insert into clip_test_unique_key values('2', '101', 'A'); ``` 原文链接:https://www.f2er.com/note/422473.html