所以我試圖創建一個新的數據庫和這些前幾行給我MYSQL - 不能添加外鍵約束 - 錯誤1215
Error 1215 - Cannot add foreign key constraint
我也試圖消除ON UPDATE/DELETE的在第二個表,但它仍然給出了同樣的錯誤
CREATE TABLE Employee(
EID INT,
SIN INT,
FName VARCHAR(20) NOT NULL,
LName VARCHAR(20) NOT NULL,
DOB DATE,
Position VARCHAR(20) NOT NULL,
civicNum VARCHAR(10) NOT NULL,
StreetName VARCHAR(20) NOT NULL,
Telephone VARCHAR(10) NOT NULL,
Contract VARCHAR(10) NOT NULL,
PRIMARY KEY(EID,SIN))ENGINE=INNODB;
CREATE TABLE FullTime(
EID INT,
SIN INT,
SALARY INT,
PRIMARY KEY(EID,SIN),
FOREIGN KEY(EID) REFERENCES Employee(EID)
ON UPDATE CASCADE
ON DELETE CASCADE,
FOREIGN KEY(SIN) REFERENCES Employee(SIN)
ON UPDATE CASCADE
ON DELETE CASCADE)ENGINE=INNODB;