navicat11.1.13版本,已创建change818数据库
USE change818;
CREATE TABLE student(
id int(11) NOT NULL AUTO_INCREMNT,
stu_no varchar(10) NOT NULL,
stu_name varchar(20) NOT NULL,
age tinyint)(3) DEFAULT NULL,
sex char(2) DEFAULT NULL,
create_date datetime DEFAULT NULL,
PRIMARY KEY (id),
UNIQUE KEY stu_no(stu_no)
)ENGINE=InnoDB DEFAULT CHARSET=utf8;
运行结果及报错内容
[SQL]
CREATE TABLE student(
id int(11) NOT NULL AUTO_INCREMNT,
stu_no varchar(10) NOT NULL,
stu_name varchar(20) NOT NULL,
age tinyint)(3) DEFAULT NULL,
sex char(2) DEFAULT NULL,
-- create_date datetime DEFAULT NULL,
PRIMARY KEY (id),
UNIQUE KEY stu_no(stu_no)
)ENGINE=InnoDB DEFAULT CHARSET=utf8;
[Err] 1064 - You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '
stu_no varchar(10) NOT NULL,
stu_name varchar(20) NOT NULL,
age tinyint)(...' at line 2