问题是因为今天妹子问我一个sql异常,但是我mac跑确实正常的,她的是win7:
==============创建表
CREATE TABLE `area` (
`id` int(10) NOT NULL auto_increment COMMENT 'ID',
`codeid` int(10) NOT NULL default '0' COMMENT '城市编码',
`parentid` int(10) NOT NULL default '0' COMMENT '父级ID',
`name` varchar(30) NOT NULL default '' COMMENT '城市省份区县名称',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8;
===============执行的SQL语句:
insert into area(codeid,parentid,name) values(11,0,'北京');
===============
我的mac执行正常,而妹子报错为:
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 'area(codeid,parentid,name) values(11,0,'北京')' at line 1
在sql上面改为`area`就可以了,因为area关键字/保留字(但是我没找到相关带有area关键字的文档...)
===============
但是我很好奇,为什么我的mac在命令行下执行成功,而妹子的win7却失败了...
怀疑是版本关键字不同,或者mac与win下某些配置项不同.
求正解.谢谢.
===============
版本:
我的:osx10.9.2 + mysql5.6.17
妹子:win7 + mysql5.0.96
==============创建表
CREATE TABLE `area` (
`id` int(10) NOT NULL auto_increment COMMENT 'ID',
`codeid` int(10) NOT NULL default '0' COMMENT '城市编码',
`parentid` int(10) NOT NULL default '0' COMMENT '父级ID',
`name` varchar(30) NOT NULL default '' COMMENT '城市省份区县名称',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8;
===============执行的SQL语句:
insert into area(codeid,parentid,name) values(11,0,'北京');
===============
我的mac执行正常,而妹子报错为:
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 'area(codeid,parentid,name) values(11,0,'北京')' at line 1
在sql上面改为`area`就可以了,因为area关键字/保留字(但是我没找到相关带有area关键字的文档...)
===============
但是我很好奇,为什么我的mac在命令行下执行成功,而妹子的win7却失败了...
怀疑是版本关键字不同,或者mac与win下某些配置项不同.
求正解.谢谢.
===============
版本:
我的:osx10.9.2 + mysql5.6.17
妹子:win7 + mysql5.0.96