猿问

将mysql workbench里面的数据模型导入到Mysql中时 sql语句有一个错误:

ErrorCode :1826 Duplicate foreign key constranit name 'college foreign key'

那一段的代码是:

CREATE TABLE IF NOT EXISTS `jyjs161`.`homework` (

  `id` INT NOT NULL AUTO_INCREMENT,

  `title` VARCHAR(145) NULL,

  `description` MEDIUMTEXT NULL,

  `start_time` DATE NULL,

  `end_time` DATE NULL,

  `course_id` INT NULL,

  PRIMARY KEY (`id`),

  INDEX `course_foreign_key_idx` (`course_id` ASC) VISIBLE,

  CONSTRAINT `course_foreign_key2`

    FOREIGN KEY (`course_id`)

    REFERENCES `jyjs161`.`course` (`id`)

    ON DELETE NO ACTION

    ON UPDATE NO ACTION)

ENGINE = InnoDB;


活力的boy54
浏览 972回答 2
2回答
随时随地看视频慕课网APP

相关分类

MySQL
我要回答