一 概述
按照MySQL5.7版本格式完成建表之后会一直提示报错,错误如下:
'Student' is not valid at this position,expecting an identifier
不可行的SQL Script
create table 'Student' (
'sid' int(10) primary key auto_increment,
'sname' varchar(16),
'sage' int(10),
'ssex' varchar(10)
) engine = Innodb default charset = utf8mb4 comment = "学生表";
执行的结果错误信息如下:
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 ''Student' ( 'sid' int(10) primary key, 'sname' varchar(16), 'sage' int(' at line 1
二 MySQL8.0可用的建表语句
可行的SQL Script
create table Student (
sid int(10) primary key auto_increment,
sname varchar(16),
sage int(10),
ssex varchar(10)
) engine = Innodb default charset = utf8mb4 comment = "学生表";
执行结果
补充,在Mysql5.7中前者是可以的,但是在Mysql8.0上需要使用后者来完成建表操作。