【Java新手笔记五】数据库sql文件导入出错

powerdesigner设计的pdm导出的sql文件,在导入数据库时报错:

Error Code: 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 '"FK_comp-area" foreign key (companyId)  references breed_company (companyId' at line 1

此处的代码是添加外键:alter table breed_area add constraint "FK_comp-area" foreign key (companyId)
      references breed_company (companyId) on delete restrict on update restrict;

出错原因是 "FK_comp-area"的双引号没有转义,直接去掉双引号。

发现comp和area之间的-也报错

改成 FK_comp_area就好了

你可能感兴趣的:(Java新手笔记)