为了账号安全,请及时绑定邮箱和手机立即绑定

mysql error number 1064?

mysql error number 1064?

蝴蝶不菲 2018-12-13 19:15:22
我写的语句是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;

查看完整回答
反对 回复 2019-01-05
  • 1 回答
  • 0 关注
  • 1767 浏览
慕课专栏
更多

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信