看了许多视频操作,发现MySQL8.0中并不能执行,
自己实践了一下
以前版本
。
但是实践的时候会出错:
例如:
18:58:25 Apply changes to 001_student Error 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 ‘)’ at line 2 SQL Statement: CREATE TABLE test
.001_student
( )
还有:
19:29:41 create table students ( ‘id’ int not null Auto_increment primary key, ‘name’ varchar(20) not null, ‘nickname’ varchar(20) null, ‘sex’ smallint not null, ‘in_time’ datetime null, ) 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 '‘id’ int not null Auto_increment primary key, ‘name’ varchar(20) not null, ‘nick’ at line 2 0.000 sec
等等。。。。
后来自己操作之后为:
代码如下:
create table students(
id int(11) not null auto_increment,
name varchar(20) not null,
nickname varchar(20) default null,
sex char(1) default null,
in_time datetime default null ,
primary key(id)
)ENGINE=InnoDB AUTO_INCREMENT=2, DEFAULT CHARSET=utf8;
insert into students value (2,‘李四’,‘四哥’,‘男’,now());
##可以自己试试看