初学者创建表时候出现了错误1064【42000】,怎么解决

创建表时候出现了错误1064【42000】

mysql> use mydb;
Database changed
mysql> create table person(
-> id int not null auto_increment primary key comment'主键id',
-> name varchar(30)comment'姓名',
-> id_number varchar(18)unique comment '身份证号'
-> );
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 ',
id_number varchar(18)unique comment '身份证号'
)' at line 3

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 ',
id_number varchar(18)unique comment '身份证号'
)' at line 3
 我把'单引号改正`反引号后依然报错
谁能帮忙看看怎么解决?

img


这个逗号有问题,改成英文的逗号

姓名后面的逗号是中文状态下的,所以报错了。

unique前面加个空格试试。

您好,我是有问必答小助手,您的问题已经有小伙伴帮您解答,感谢您对有问必答的支持与关注!
PS:问答VIP年卡 【限时加赠:IT技术图书免费领】,了解详情>>> https://vip.csdn.net/askvip?utm_source=1146287632