Mysql 在表中插入元素时出错代码:1452

Mysql 在表中插入元素时出错代码:1452,mysql,Mysql,下面是我的桌子- create table employee1( fname varchar(15) not null, minit char(15) , lname varchar(15) not null, ssn char(9) not null, bdate date, address varchar(30), sex char, salary decimal(10,2), superssn char(9), dno int not null default 1,

下面是我的桌子-

create table employee1(
 fname varchar(15) not null,
 minit char(15) ,
 lname varchar(15) not null,
 ssn char(9) not null,
 bdate date,
 address varchar(30),
 sex char,
 salary decimal(10,2),
 superssn char(9),
 dno int not null default 1,
 constraint emppk
 primary key (ssn),
 constraint empsupkerfk
 foreign key (superssn) references employee1(ssn) on delete set null on update cascade,
 constraint empdeptfk
 foreign key (dno) references department(dnumber) on delete set default on update cascade 
  );
这是我的说明书-

insert into employee1 
(
fname,minit,lname,ssn,bdate,address,sex,salary,superssn,dno
 ) 
values (
'jhon','b','smith','123456789','1955-01-09','731 fondren,houston, tx','m','30000','33344555','5'
)
这就是我得到的错误-

错误代码:1452。无法添加或更新子行:外键 约束失败(
employee
employee
,约束
employee\u ibfk\u 1
外键(
supersn
)引用
employee
ssn


错误很明显,这意味着您试图在
employee1
中插入
supersn
中不存在的
employee

从:

外键关系涉及一个包含 中心数据值,以及具有相同值的子表 返回其父级。在子级中指定外键子句 桌子

它将拒绝尝试创建的任何插入或更新操作 如果没有匹配项,则子表中的外键值 父表中的候选键值


删除了SQL Server标记,因为此查询和错误来自MySQL