简体   繁体   English

插入期间错误 1452“外键约束失败”是什么意思?

[英]What does error 1452 “a foreign key constraint fails” during an insert mean?

So I am trying to add information to a table in phpMyAdmin, but it will not let me 'add or update a child row' with error code #1452.所以我试图将信息添加到 phpMyAdmin 中的表中,但它不会让我“添加或更新子行”,错误代码为 #1452。

INSERT INTO tblBooking (BookingRef, AppRef, BookingDate, TableNo, Verified, VerifyStaffID, bPassword)

VALUES ('1', '1', '2021-03-05', 'Table 1', 'Y', '2', 'Password123'),
('2', '1', '21-01-07', 'Table 2', 'N', '3', 'Chain'),
('3', '2', '20-11-02', 'Table 3', 'Y', '1', 'aSecret'),
('4', '3', '20-12-06', 'Table 2', 'Y', '4', 'Pedal')

I get this error:[error description]我收到此错误:[错误描述]1

Thanks in advance.提前致谢。

MYSQL is complaining about a FK that doesn't exists in the parent table, so in your case one or more than one of the VerifyStaffID values ( 1, 3, 4) doesn't exists in the parent table (tblstaff) MYSQL 抱怨父表中不存在 FK,因此在您的情况下,父表 (tblstaff) 中不存在一个或多个 VerifyStaffID 值(1、3、4)

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 1452>外键约束使PDO PHP失败 - 1452 > a foreign key constraint fails PDO PHP 此错误是什么SQLSTATE [23000]:违反完整性约束:1452无法添加或更新子行:外键约束失败 - what is this error SQLSTATE[23000]: Integrity constraint violation: 1452 Cannot add or update a child row: a foreign key constraint fails 违反完整性约束:1452 无法添加或更新子行:外键约束失败错误 - Integrity constraint violation: 1452 Cannot add or update a child row: a foreign key constraint fails error MYSQL错误1452 foriegn键约束失败 - MYSQL ERROR 1452 A foriegn key constraint fails 如何解决错误号:1452-无法添加或更新子行:外键约束失败 - How to solve Error Number: 1452 - Cannot add or update a child row: a foreign key constraint fails Yii添加新记录错误:1452无法添加或更新子行:外键约束失败 - Yii on adding new record error : 1452 Cannot add or update a child row: a foreign key constraint fails 无法添加或更新子行,外键约束失败,mysql错误号:1452 - cannot add or update a child row a foreign key constraint fails mysql Error Number: 1452 错误号:1452无法添加或更新子行:外键约束失败 - Error Number: 1452 Cannot add or update a child row: a foreign key constraint fails 1452无法添加或更新子行:外键约束失败 - 1452 Cannot add or update a child row: a foreign key constraint fails mysql错误错误SQLSTATE [23000]:完整性约束违规:1452无法添加或更新子行:外键约束失败? - mysql error error SQLSTATE[23000]: Integrity constraint violation: 1452 Cannot add or update a child row: a foreign key constraint fails?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM