· 8 years ago · Dec 16, 2017, 06:38 PM
1CREATE TABLE IF NOT EXISTS `agoravai`.`exam` (
2 `id` INT UNSIGNED NOT NULL AUTO_INCREMENT,
3 `year` INT NOT NULL,
4 `creation_date` DATETIME NOT NULL,
5 `teacher_name` VARCHAR(64) NOT NULL,
6 `university_id` INT NOT NULL,
7 `course_id` INT UNSIGNED NOT NULL,
8 `discipline_id` INT UNSIGNED NOT NULL,
9 `account_id` INT UNSIGNED NOT NULL,
10 PRIMARY KEY (`id`),
11 INDEX `fk_exam_discipline_idx` (`discipline_id` ASC),
12 INDEX `fk_exam_account_idx` (`account_id` ASC),
13 INDEX `fk_exam_course_idx` (`course_id` ASC),
14 INDEX `fk_exam_university_idx` (`university_id` ASC),
15 CONSTRAINT `fk_exam_discipline`
16 FOREIGN KEY (`discipline_id`)
17 REFERENCES `agoravai`.`discipline` (`id`)
18 ON DELETE NO ACTION
19 ON UPDATE NO ACTION,
20 CONSTRAINT `fk_exam_account`
21 FOREIGN KEY (`account_id`)
22 REFERENCES `agoravai`.`account` (`id`)
23 ON DELETE NO ACTION
24 ON UPDATE NO ACTION,
25 CONSTRAINT `fk_exam_course`
26 FOREIGN KEY (`course_id`)
27 REFERENCES `agoravai`.`course` (`id`)
28 ON DELETE NO ACTION
29 ON UPDATE NO ACTION,
30 CONSTRAINT `fk_exam_university`
31 FOREIGN KEY (`university_id`)
32 REFERENCES `agoravai`.`university` (`id`)
33 ON DELETE NO ACTION
34 ON UPDATE NO ACTION)
35ENGINE = InnoDB;