在MySQL中,创建表写注释的时候,可能会出现这种错误
这是由于#后面的逗号也被注释掉了,导致出现了语法错误
解决方法有两种
第一种:
利用comment’'进行注释:
select * from `tb_hero`;
drop table if exists `student`;
create table `student`(
`StuId` int not null auto_increment comment '学生学号',
`StuName` varchar(50) not null comment '学生姓名',
);
第二种:
把原来的注释放在新建的一行:
select * from `tb_hero`;
drop table if exists `student`;
create table `student`(
#学生学号
`StuId` int not null auto_increment,
`StuName` varchar(50) not null comment '学生姓名',
);