zoukankan      html  css  js  c++  java
  • 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 that
    2 corresponds to your MySQL server version for the right syntax to use near 'desc
    3 ) values("WZC504-TZ","开关","双速","60","51","41","eb3.jpg","")' at line 1

    原因:列名跟Mysql的关键字重叠。

    那就应该是desc的起名问题了,修改为describe,依然报错。这两个都是Mysql的关键字!

    改成description,问题解决。

  • 相关阅读:
    实现一个简易的Spring MVC
    解决IntelIij DEA控制台乱码
    01、SpringBoot中关于tomcat的一些常用配置
    Java动态代理的简单实现
    MVVM中viewmodel的理解
    eclipse常用快捷键
    导入mysql报错问题
    mysql主从配置思路
    rpm安装jdk7
    13个开源GIS软件 你了解几个?
  • 原文地址:https://www.cnblogs.com/yoyotl/p/5845331.html
Copyright © 2011-2022 走看看