热线电话:13121318867

登录
2020-07-06 阅读量: 953
SQL报错:外键约束

Error Code: 1452. Cannot add or update a child row: a foreign key constraint fails (`test`.`employee1`, CONSTRAINT `employee1_ibfk_1` FOREIGN KEY (`deptid`) REFERENCES `dept` (`deptno`))

image.png

建表代码如图

image.png

解决:

没有导入部门信息,先导入部门信息,再导入员工表信息,因为员工表受外键约束(部门表的编号)

image.png

image.png

22.4569
5
关注作者
收藏
评论(0)

发表评论

暂无数据
推荐帖子