0
我正在使用mysql並且不斷收到錯誤。我認爲這是因爲我沒有備用鑰匙,但我不知道如何設置鑰匙。錯誤:錯誤1064:您的SQL語法中有錯誤
CREATE TABLE IF NOT EXISTS `Employee`.`Employee` (
`PersonId` INT NOT NULL,
`EmployeeID` INT NOT NULL,
`FName` VARCHAR(45) NOT NULL,
`MName` VARCHAR(45) NOT NULL,
`LName` VARCHAR(60) NOT NULL,
`DOB` DATE NOT NULL,
`Gender` VARCHAR(1) NOT NULL,
`Enthnicity` VARCHAR(45) NOT NULL,
`PersonalEmail` VARCHAR(100) NULL,
`WorkEmail` VARCHAR(100) NULL,
`Department` VARCHAR(30) NULL,
`Building` VARCHAR(20) NOT NULL,
`OfficeNumber` VARCHAR(10) NOT NULL,
PRIMARY KEY (`PersonId`),
UNIQUE INDEX `EmployeeID_UNIQUE` (`EmployeeID` ASC),
UNIQUE INDEX `PersonalEmail_UNIQUE` (`PersonalEmail` ASC),
UNIQUE INDEX `WorkEmail_UNIQUE` (`WorkEmail` ASC),
CONSTRAINT `Department`
FOREIGN KEY()
REFERENCES `Employee`.`Department`()
ON DELETE NO ACTION
ON UPDATE NO ACTION)
ENGINE = InnoDB
謝謝。