这有什么问题?
ALTER TABLE `groups`
ADD COLUMN `forum_enabled` enum('0','1') CHARACTER SET latin1 COLLATE
latin1_swedish_ci NOT NULL DEFAULT '0' AFTER `admindeco`;
ALTER TABLE `user_badges`
ADD UNIQUE INDEX `user_id, badge_id`;
ALTER TABLE `furniture`
ADD COLUMN`behaviour_data` int(11) NOT NULL DEFAULT 0 AFTER
`interaction_type`;
ALTER TABLE `users`
MODIFY COLUMN `rank_vip` int(1) NULL DEFAULT 1 AFTER `rank`;
ALTER TABLE `server_settings`
CHANGE COLUMN `variable` `key` varchar(255) CHARACTER SET latin1 COLLATE
latin1_swedish_ci NOT NULL DEFAULT 'server.variable' FIRST ;
ALTER TABLE `catalog_deals`
DROP COLUMN `page_id`,
DROP COLUMN `cost_credits`,
DROP COLUMN `cost_pixels`,
MODIFY COLUMN `items` text CHARACTER SET latin1 COLLATE
latin1_swedish_ci
NOT NULL AFTER `id`,
ADD COLUMN `room_id` int(11) NOT NULL AFTER `name`;
SET FOREIGN_KEY_CHECKS=0;
我收到以下错误:
sql查询:alter table groups add column forum\u enabled enum('0','1')字符集latin1 collate latin1\u瑞典语\u ci not null admindeco后的默认值“0”;mysql说:文档#1060-重复的列名'forumŠu enabled'
1条答案
按热度按时间tmb3ates1#
从错误消息来看,您试图在第一条语句中添加的列似乎已经存在于表中。
一个简单的解决方案是在添加列之前删除它,如:
这可以与
ADD
命令,如:还可以动态检查列是否存在,然后在需要时删除它,如: