2011-05-03 38 views
1

這裏得到的是錯誤:在服務器我無法破譯的MySQL錯誤日誌,通過「正向工程」選項

執行SQL腳本

ERROR: Error 1064: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ') 

    REFERENCES `mydb`.`Skill`() 
    ON DELETE NO ACTION 
    ON UPDATE NO ACTI' at line 5 

CREATE TABLE IF NOT EXISTS `mydb`.`employeeSkill` (
    `idEmployee` INT NOT NULL , 
    PRIMARY KEY (`idEmployee`) , 
    CONSTRAINT `idSkill` 
    FOREIGN KEY() 
    REFERENCES `mydb`.`Skill`() 
    ON DELETE NO ACTION 
    ON UPDATE NO ACTION) 
ENGINE = InnoDB 

SQL script execution finished: statements: 18 succeeded, 1 failed 

回答

0

你已經混了語法用定義表約束來定義列約束。在表名之後的parens內部,應該有逗號分隔的列定義列表,其格式爲「column_name column_type column_constraints」,其中唯一所需的元素是列名稱。但在第一個逗號後面,您有PRIMARY KEY (idEmployee),這不是列定義。 (相反,它是適用於ALTER TABLE命令的語法。)檢查CREATE TABLE命令here的語法。

+0

非常感謝! – Kareem 2011-05-03 06:33:35

相關問題