Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
如屏幕截图所示,两个字段:客户表中的 cust_id 和 ShelfLocation 表中的 Store_ID 具有相同的签名,但我仍然无法从 Store_ID 引用 cust_id。有什么帮助吗?
这为我解决了这个问题:在第一行之前添加:
SET FOREIGN_KEY_CHECKS = 0;
在最后一行之后添加:
SET FOREIGN_KEY_CHECKS = 1;
解决方案是检查以确保Primary_Key并Foreign_Key完全匹配它们的数据类型。
Primary_Key
Foreign_Key
如果一个已签名而另一个未签名,它将失败。好的做法是确保两者都是无符号 INT。