我正在为我的班级工作我的数据库项目,我无法弄清楚为什么我的ENROLL表给了我
我没有想法,我已经检查了我的书。任何建议将不胜感激。" ERROR 1215(HY000):无法添加外键约束"
CREATE TABLE COURSE
(COURSE_ID INT(11) NOT NULL AUTO_INCREMENT PRIMARY KEY,
SUBJECT_ID INT(11) NOT NULL,
COURSE_GRADE_LEVEL CHAR(2) NOT NULL,
FAC_ID INT NOT NULL,
FOREIGN KEY(FAC_ID) REFERENCES FACULTY(FAC_ID))
CREATE TABLE STUDENT
(STU_ID INT(11) NOT NULL AUTO_INCREMENT PRIMARY KEY,
STU_FNAME VARCHAR(30) NOT NULL,
STU_LNAME VARCHAR(30) NOT NULL,
STU_DOB VARCHAR(30) NOT NULL,
STU_STREET VARCHAR(150),
STU_CITY VARCHAR(50),
STU_STATE VARCHAR(3),
STU_ZIP VARCHAR(6),
STU_PHONE CHAR(12),
STU_GRADE_LEVEL CHAR(2) NOT NULL);
CREATE TABLE ENROLL
( COURSE_ID INT(11) NOT NULL ,
STU_ID INT(11) NOT NULL,
GRADE CHAR(3) NOT NULL,
FOREIGN KEY(COURSE_ID) REFERENCES COURSE(COURSE_ID),
FOREIGN KEY(STU_ID) REFERENCES STUDENT(STU_ID),
PRIMARY KEY (COURSE_ID,STU_ID));