两种语法我都试过了:
Alter Table bc DROP FOREIGN KEY STUD_ID;
出现错误:无法删除“STUD_ID”;检查列/键是否存在
Alter Table bc DROP CONSTRAINT STUD_ID;
报错:
ERROR 1064 (42000): 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 'CONSTRAINT STUD_ID' at line 1
建议我可能的方法。
最佳答案
ALTER TABLE TableName DROP FOREIGN KEY ForeignKeyConstraintName;
希望这有帮助:)
关于mysql - 如何删除mysql中的外键?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43631392/