Cannot add or update a child row: a foreign key constraint fails (`company`.`employee`, CONSTRAINT `employee_department_department_id_fk` FOREIGN KEY (`department_id`) REFERENCES `department` (`department_id`))
很明显插入的时候失败了。我寻找了一下原因,原来是插入数据的时候,外键的值在对应表的主键中不存在,所以插入失败。这个问题挺隐蔽的,积累经验啦。
Cannot add or update a child row: a foreign key constraint fails (`company`.`employee`, CONSTRAINT.
最新推荐文章于 2024-10-24 22:09:02 发布
6297

被折叠的 条评论
为什么被折叠?



