我正在尝试在MySQL Workbench上创建一个表,但它显示了错误:
“()”(右括号)在创建表时在此位置无效输入
关于最后一个右括号:
create table generics (
idGen int unsigned not null auto_increment,
nameGen nvarchar (255) not null,
type_id int not null,
id2 int not null,
pk int not null,
active bit not null,
created_at datetime null,
updated_at datetime null,
created_by nvarchar(255) null,
updated_by nvarchar(255) null,
constraint primary key(idGen),
constraint foreign key(type_id)
)
我已经读到,有时在使用BOM表另存为UTF8时遇到问题时有时会发生这种情况,但是此查询尚未保存,我也从未遇到过此问题,而且这是我第一次使用nvarchar,所以如果与idk有关,则为idk。
对于外键约束,您缺少参考部分。此键应指向另一个表中的主键。
做一件事,使用mysql工作台中的设计视图创建表,然后将该表导出为脚本,您将获得使用脚本编写表的方法,然后对现有脚本进行更改,此错误将消失希望这会有所帮助