我写的语句是ALTER TABLE `vshare`.`member` DROP PRIMARY KEY,ADD PRIMARY KEY (`id`),ADD CONSTRAINT `FK_member_cotegory` FOREIGN KEY `FK_member_cotegory` ()REFERENCES `cotegory` ()ON DELETE RESTRICTON UPDATE RESTRICT;错误提示是:You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ')REFERENCES `cotegory` ()ON DELETE RESTRICTON UPDATE RESTRICT' at line 3
1 回答
宝慕林4294392
TA贡献2021条经验 获得超8个赞
主键字段 和 外键字段没有啊
FK_member_cotegory` ()括号中是member外键字段,你这里是空的
REFERENCES `cotegory` ()括号中是引用的主键表cotegory的主键字段,你这里是空的
可达是要报错的啊 ,建议修改成 如下形式
ALTER TABLE `vshare`.`member` DROP PRIMARY KEY,
ADD PRIMARY KEY (`id`),
ADD CONSTRAINT `FK_member_cotegory` FOREIGN KEY `FK_member_cotegory` (`cotegoryID`)
REFERENCES `cotegory` (`ID`)
ON DELETE RESTRICT
ON UPDATE RESTRICT;
添加回答
举报
0/150
提交
取消