mysql 唯一键约束

1.代码方式

CREATE TABLE `game_device_detail` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `name` varchar(50) COLLATE utf8mb4_bin DEFAULT NULL,
  `count_date` date DEFAULT NULL,
  `sell_count` int(11) DEFAULT NULL,
  `scrapy_date` datetime DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `uni_name_count` (`name`,`count_date`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=89 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;

2.Navicat

mysql 唯一键约束_第1张图片

http://www.waitingfy.com/archives/5143

你可能感兴趣的:(mysql)