在进行MySQL创建表时出现了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 primary key auto_increment,
‘username’ varchar(20) not null unique,
‘pa’ at line 2 的错误
我的创建语句为:
DROP DATABASE IF EXISTS book;
CREATE DATABASE book;
USE book;
CREATE TABLE t_user(
id
INT PRIMARY KEY AUTO_INCREMENT,
username
VARCHAR(20) NOT NULL UNIQUE,
password
VARCHAR(32) NOT NULL,
email
VARCHAR(200)
);
INSERT INTO t_user(username
, password
,email
) VALUES (‘admin’,‘admin’,‘admin@atguigu.com’);
SELECT * FROM t_user;
后来发现是单引号和反单引号使用错误,反单引号是在数字的最左边。