0
不能添加或更新子行,外键约束失败(mini_project
tbl_login
,约束FK_tbl_login_tbl_userinfo
外键(userId
)参考文献tbl_userinfo
(userId
))com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException:
问题是什么?
不能添加或更新子行,外键约束失败(mini_project
tbl_login
,约束FK_tbl_login_tbl_userinfo
外键(userId
)参考文献tbl_userinfo
(userId
))com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException:
问题是什么?
您正试图在具有引用tbl_userinfo中的用户标识的外键的表中插入一行。
您正试图输入一个不在tbl.userinfo中的值,并且由于存在引用完整性约束,因此您无法这样做。
更多信息:https://dev.mysql.com/doc/refman/5.6/en/create-table-foreign-keys.html
外键关系涉及持有中央数据值的父表,并与指回其父相同的值的子表。 FOREIGN KEY子句在子表中指定。
如果父表中没有匹配的候选键值,它将拒绝尝试在子表中创建外键值的任何INSERT或UPDATE操作。