mysql创建表出现问题

mysql5.7建表的时候出现这种问题怎么解决,帮帮我。
mysql> create table yuangong(
-> id int(4)primary key not null unique,
-> name varchar(20) not null,
-> sex varchar(4) not null,
-> birthday int(4),
-> d_id int(20) not null,
-> salary float,
-> address varchar(50),
-> constraint yuangong_fk foreign key(d_id)
-> references department(d_id)
-> );
ERROR 1064 (42000): 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 '4 )primary key not null unique,
name varchar(20) not null,
sex varchar(4) not n' at line 2

题主的创表语句出现了中文括号,sql中是不能使用中文的标点符号的,以后写sql应该注意,
并且建议使用一些文本编辑工具,比如notepadd++或者vscode,可以清晰看出来是否有中文符号

img


修正后的SQL:

create table yuangong(
    id int(4) primary key not null unique,
    name varchar(20) not null,
    sex varchar(4) not null,
    birthday int(4),
    d_id int(20) not null,
    salary float,
    address varchar(50),
    constraint yuangong_fk foreign key(d_id)
    references department(d_id)
);

格式有问题吧

这个括号是中文的吧,换英文的括号

img

img