表的结构是这样的
Insert into cure values
(330103,300366,'2017-11-10',null),
(330103,200601,'2017-11-25',null)
错误提示:> 1452 - Cannot add or update a child row: a foreign key constraint fails (`doctordb`.`cure`, CONSTRAINT `s` FOREIGN KEY (`SID`) REFERENCES `suffer` (`SID`))
主键外键的操作
ALTER TABLE cure ADD PRIMARY KEY (DID,SID);
alter table cure add constraint d foreign key(DID) references doctorinfo(DID);
alter table cure add constraint s foreign key(SID) references suffer(SID);