#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL

CREATE TABLE 'test' (
'id' int(10) NOT NULL auto_increment,
'uid' varchar(10) NOT NULL default '0',
'regdate' date NOT NULL,
'remark' text,
PRIMARY KEY ('id')
) ENGINE=innoDB DEFAULT CHARSET=gbk AUTO_INCREMENT=5;

INSERT INTO 'test'('id','uid','regdate','remark') VALUES
(1,'张','2008-07-02','学生'),
(2,'李','2008-07-03','工人'),
(3,'王','2008-07-04','学生'),
(4,'陈','2008-07-05','工人');
代码报错求解……
MySQL 返回:
#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 ''test' (
'id' int(10) NOT NULL auto_increment,
'uid' varchar(10) NOT NULL ' at line 1

试试这个代码:
INSERT INTO 'test'('id','uid','regdate','remark') VALUES
((1,'张','2008-07-02','学生'),
(2,'李','2008-07-03','工人'),
(3,'王','2008-07-04','学生'),
(4,'陈','2008-07-05','工人'));

就是加了前后括号。追问

还是一样的错误-。-

追答

CREATE TABLE 'test' (
'id' int(10) NOT NULL auto_increment,
'uid' varchar(10) NOT NULL default '0',
'regdate' date NOT NULL,
'remark' text,
PRIMARY KEY ('id')
) ENGINE=innoDB DEFAULT CHARSET=gbk AUTO_INCREMENT=5;

把字些字段上的单引号去掉。要加,也是加 ` 号,不是 ' 号

温馨提示:答案为网友推荐,仅供参考
相似回答