mysql 修改主键自增,新增联合主键


ALTER TABLE `onduty_history`

MODIFY COLUMN `id`  int(11) NOT NULL AUTO_INCREMENT FIRST ,
MODIFY COLUMN `name`  varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL AFTER `id`,
MODIFY COLUMN `onduty_date`  datetime NOT NULL AFTER `name`,
ADD UNIQUE KEY (`id`),
ADD PRIMARY KEY (`name`, `onduty_date`);

你可能感兴趣的:(mysql 修改主键自增,新增联合主键)