mySQL中删除unique key的语法
表结构:
CREATE TABLE IF NOT EXISTS `ipadsoft` (
`id_sid` int(11) NOT NULL AUTO_INCREMENT COMMENT '软件id',
`id_sname` varchar(100) NOT NULL COMMENT '软件名称',
`id_spictures` varchar(200) NOT NULL COMMENT '图片地址',
`id_size` varchar(20) NOT NULL COMMENT '软件大小',
`id_slicence` varchar(30) NOT NULL COMMENT '许可证',
`id_supday` varchar(20) NOT NULL COMMENT '更新日期',
`id_sos` varchar(30) NOT NULL COMMENT '操作系统',
`id_spromulgator` varchar(50) NOT NULL COMMENT '发布者',
`id_sdescribe` text NOT NULL COMMENT '描述',
`id_sdownurl` varchar(200) NOT NULL COMMENT '下载地址',
`id_cid` int(11) NOT NULL COMMENT '类id',
PRIMARY KEY (`id_sid`),
UNIQUE KEY `id_sdownurl` (`id_sdownurl`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='ipad软件详情表'
`id_sid` int(11) NOT NULL AUTO_INCREMENT COMMENT '软件id',
`id_sname` varchar(100) NOT NULL COMMENT '软件名称',
`id_spictures` varchar(200) NOT NULL COMMENT '图片地址',
`id_size` varchar(20) NOT NULL COMMENT '软件大小',
`id_slicence` varchar(30) NOT NULL COMMENT '许可证',
`id_supday` varchar(20) NOT NULL COMMENT '更新日期',
`id_sos` varchar(30) NOT NULL COMMENT '操作系统',
`id_spromulgator` varchar(50) NOT NULL COMMENT '发布者',
`id_sdescribe` text NOT NULL COMMENT '描述',
`id_sdownurl` varchar(200) NOT NULL COMMENT '下载地址',
`id_cid` int(11) NOT NULL COMMENT '类id',
PRIMARY KEY (`id_sid`),
UNIQUE KEY `id_sdownurl` (`id_sdownurl`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='ipad软件详情表'
想删除某个表中某个字段的unique key:
ALTER TABLE ipadsoft DROP INDEX
id_sdownurl;
select * from `iphonesoft` group by `ie_cid` having count(`ie_cid`)>1
ALTER TABLE `keyword` ADD UNIQUE (`k_id`)
ALTER TABLE `keyword` ADD UNIQUE (`k_id`)
windows下重启mysql
net stop mysql
net start mysql