MySQL Workbench 1064语法错误

时间:2016-12-21 03:25:17

标签: mysql mysql-workbench

MySQL Workbench创建了这个代码,而不是我。我刚刚使用了GUI。

Operation failed: There was an error while applying the SQL script to the database.
Executing:
ALTER TABLE `isometr1_keyboard`.`records` 
ADD CONSTRAINT `fk_records_layout_id`
  FOREIGN KEY ()
  REFERENCES `isometr1_keyboard`.`layouts` ()
  ON DELETE NO ACTION
  ON UPDATE NO ACTION;

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 `isometr1_keyboard`.`layouts` ()
  ON DELETE NO ACTION
  ON UPDAT' at line 3
SQL Statement:
ALTER TABLE `isometr1_keyboard`.`records` 
ADD CONSTRAINT `fk_records_layout_id`
  FOREIGN KEY ()
  REFERENCES `isometr1_keyboard`.`layouts` ()
  ON DELETE NO ACTION
  ON UPDATE NO ACTION

我不明白错误在哪里。也不明白为什么GUI正在创建有缺陷的代码。

我犯了错误吗?

1 个答案:

答案 0 :(得分:0)

列的数据类型不匹配。这导致MySQL Workbench创建了不正确的代码。