CREATE TABLE `assessmentbookdb`.`MCQs` (
`id` INT NOT NULL AUTO_INCREMENT ,
`MCQAnswer` VARCHAR(200) NOT NULL ,
`QuestionID` INT NOT NULL ,
PRIMARY KEY (`id`) ,
INDEX `QuestionID` (`QuestionID` ASC) ,
CONSTRAINT `QuestionID`
FOREIGN KEY (`QuestionID` )
REFERENCES `assessmentbookdb`.`Question` (`QuestionID` )
ON DELETE CASCADE
ON UPDATE CASCADE)
ENGINE = InnoDB;
消息日志:
错误 1005:无法创建表 'assessmentbookdb.mcqs' (errno: 121) SQL 语句:
CREATE TABLE `assessmentbookdb`.`MCQs` (
`id` INT NOT NULL AUTO_INCREMENT ,
`MCQAnswer` VARCHAR(200) NOT NULL ,
`QuestionID` INT NOT NULL ,
PRIMARY KEY (`id`) ,
INDEX `QuestionID` (`QuestionID` ASC) ,
CONSTRAINT `QuestionID`
FOREIGN KEY (`QuestionID` )
REFERENCES `assessmentbookdb`.`Question` (`QuestionID` )
ON DELETE CASCADE
ON UPDATE CASCADE)
ENGINE = InnoDB