首页 > 代码库 > Mysql ERROR 1064 (42000)
Mysql ERROR 1064 (42000)
创建了一个表:
1 +-------------+--------------+------+-----+---------+----------------+ 2 | Field | Type | Null | Key | Default | Extra | 3 +-------------+--------------+------+-----+---------+----------------+ 4 | id | int(11) | NO | PRI | NULL | auto_increment | 5 | model | varchar(80) | NO | | NULL | | 6 | type | varchar(32) | NO | | NULL | | 7 | name | varchar(48) | NO | | NULL | | 8 | price | varchar(32) | NO | | NULL | | 9 | salePrice | varchar(32) | NO | | NULL | |10 | traderPrice | varchar(32) | NO | | NULL | |11 | picture | varchar(128) | NO | | NULL | |12 | desc | varchar(128) | NO | | NULL | |13 +-------------+--------------+------+-----+---------+----------------+
执行以下语句:
mysql> insert into product (model,type,name,price,salePrice,traderPrice,picture,desc) values("WZC504-TZ","开关","双速","60","51","41","eb3.jpg","");
得到错误信息:
1 ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that2 corresponds to your MySQL server version for the right syntax to use near ‘desc3 ) values("WZC504-TZ","开关","双速","60","51","41","eb3.jpg","")‘ at line 1
原因:列名跟Mysql的关键字重叠。
那就应该是desc的起名问题了,修改为describe,依然报错。这两个都是Mysql的关键字!
改成description,问题解决。
Mysql ERROR 1064 (42000)
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。