我不太明白为什么该错误始终显示为“#1215-无法添加外键约束”。我遵循了所提供的学生指南。
我尝试过了。请帮忙。
DROP TABLE IF EXISTS `AircraftType_Airport`;
CREATE TABLE IF NOT EXISTS `AircraftType_Airport`(
`AT_ID` varchar(15) NOT NULL,
`Ap_Code` varchar(10) NOT NULL,
CONSTRAINT AircraftTypeAirport_pk_ATID_ApCode PRIMARY KEY (`AT_ID`, `Ap_Code`),
CONSTRAINT AircraftTypeAirport_fk_ATID FOREIGN KEY (`AT_ID`) REFERENCES `Aircraft_Type`(`AT_ID`),
CONSTRAINT AircraftTypeAirport_fk_ApCode FOREIGN KEY (`Ap_Code`) REFERENCES `Aircraft_Type`(`Ap_Code`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;