CREATE DATABASE IF NOT EXISTS UNIVERSITY;
USE UNIVERSITY;
CREATE TABLE IF NOT EXISTS STUDENT
(
STUDENT_NO VARCHAR(25) NOT NULL UNIQUE,
STUDENT_NAME VARCHAR(255),
ADDRESS VARCHAR(255),
YEAR_STUDY INT,
SEX VARCHAR(5),
DATE_OF_BIRTH DATE,
COURSE_NO VARCHAR(10),
PRIMARY KEY(STUDENT_NO)
)
ENGINE=INNODB;
CREATE TABLE IF NOT EXISTS SUBJECT
(
SUBJECT_NO VARCHAR(10) NOT NULL UNIQUE,
SUBJECT_NAME VARCHAR(255),
DEPT_NAME VARCHAR(255),
PRIMARY KEY(SUBJECT_NO)
)
ENGINE=INNODB;
CREATE TABLE IF NOT EXISTS RESULTS
(
STUDENT_NO VARCHAR(25) NOT NULL UNIQUE,
SUBJECT_NO VARCHAR(25) NOT NULL UNIQUE,
YEAR_EXAM INT,
MARKS INT,
PRIMARY KEY(STUDENT_NO, SUBJECT_NO),
FOREIGN KEY(STUDENT_NO) REFERENCES STUDENT(STUDENT_NO),
FOREIGN KEY(SUBJECT_NO) REFERENCES SUBJECT(SUBJECT_NO)
)
ENGINE=INNODB;
CREATE TABLE IF NOT EXISTS COURSE
(
COURSE_NO VARCHAR(10) NOT NULL UNIQUE,
TITLE VARCHAR(255),
DURATION INT,
PRIMARY KEY(COURSE_NO)
)
ENGINE=INNODB;
CREATE TABLE IF NOT EXISTS COURSE_SUB
(
COURSE_NO VARCHAR(10) NOT NULL UNIQUE,
SUBJECT_NO VARCHAR(10) NOT NULL UNIQUE,
PRIMARY KEY(COURSE_NO, SUBJECT_NO),
FOREIGN KEY(COURSE_NO) REFERENCES COURSE(COURSE_NO),
FOREIGN KEY(SUBJECT_NO) REFERENCES SUBJECT(SUBJECT_NO)
)
ENGINE=INNODB;
我正在创建一个数据库,但它有一些错误我找不到什么错误
请帮忙