我无法弄清楚这个错误消息。我知道有类似的帖子,但他们没有帮助。
错误 1452:无法添加或更新子行:外键约束失败 (
workingmodel
.cadet
, CONSTRAINTfk_Cadet_YEAR_t1
FOREIGN KEY (YEAR_t_idYEAR_t
) REFERENCESyear_t
(idYEAR_t
) ON DELETE NO ACTION ON UPDATE NO ACTION)
SQL 语句:
INSERT INTO `workingmodel`.`cadet` (`CID`, `YEAR_t_idYEAR_t`, `Rank_idRank`, `BN_idBN`, `PTscore`, `Academic_idAcademic`, `CadetLastName`, `CadetFirstName`) VALUES ('00123456', '2015', 'CPL', '2', '220', 'CS', 'Matthews', 'Bob')