gpt4 book ai didi

mysql - 错误 1215 外键约束

转载 作者:行者123 更新时间:2023-11-28 23:23:18 25 4
gpt4 key购买 nike

我对此还是很陌生,所以在我学习规则时请耐心等待。我的 mysql 脚本有问题,它给了我一个非常常见的 1215 错误(无法创建外键)

我已经检查了数据类型,外键引用了主键,但仍然无法正常工作。

The script. Issue is with the two final foreign keys

最佳答案

必须这样声明:

必须先声明外键:

Create table(id ... , foreignKEY INT NOT NULL,
Constraint FOREIGN KEY(foreignKEY) REFERENCES table_refered(it primary key));

//foreignKEY- 必须先声明为列,然后再声明为 FOREIGN KEY 祝你好运。

关于mysql - 错误 1215 外键约束,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40535435/

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