ERROR 1005(HY000)在線路__:無法創建表 'doanv.ENROLLED'(錯誤:150) 再見爲什麼我不能在MySQL中創建表? ERROR 1005(HY000)
表STUDENT
,COURSE
,PROF
成功創建。
表ENROLLED
和TEACHING
無法創建。
我做錯了什麼?
CREATE TABLE STUDENT
(sID INTEGER PRIMARY KEY NOT NULL,
sFName VARCHAR(20),
sLName VARCHAR(20));
CREATE TABLE COURSE
(cID VARCHAR(20) PRIMARY KEY NOT NULL,
cName VARCHAR(20),
cr INTEGER);
CREATE TABLE PROF
(pID INTEGER PRIMARY KEY NOT NULL,
pFName VARCHAR(20),
pLName VARCHAR(20));
CREATE TABLE ENROLLED
(sID INTEGER NOT NULL,
cID VARCHAR(20) NOT NULL,
PRIMARY KEY (sID, cID),
FOREIGN KEY (sID) REFERENCES STUDENT,
FOREIGN KEY (cID) REFERENCES COURSE);
CREATE TABLE TEACHING
(pID INTEGER NOT NULL,
cID VARCHAR(20) NOT NULL,
PRIMARY KEY (pID, cID),
FOREIGN KEY (pID) REFERENCES PROF,
FOREIGN KEY (cID) REFERENCES COURSE);
你可以離開標題的MYSQL,mysql標籤就足夠了。 –