gpt4 book ai didi

mysql - 如何删除mysql中的外键?

转载 作者:可可西里 更新时间:2023-11-01 09:00:41 24 4
gpt4 key购买 nike

两种语法我都试过了:

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/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com