zoukankan      html  css  js  c++  java
  • check the manual that corresponds to your MySQL server version-与保留关键字冲突

    UPDATE configuration SET value = 7 where key ='extendDays';


    [SQL]UPDATE configuration SET value = '7' where key ='extendDays';
    [Err] 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 'key ='extendDays'' at line 1
    翻译后:
    [错误] 1064  - 您的SQL语法有错误; 检查与MySQL服务器版本对应的手册,以便在第1行的'key ='extendDays''附近使用正确的语法

    从表面上看没有错呀,很纳闷却报语法错误,其实是将保留关键字key,value作为字段名导致的,若非要引用保留关键字作为表名、字段名,有两种解决方法:
    1.需要给数据库名、表名后加点之后引用
    UPDATE configuration c SET c.value = 7 where c.key ='extendDays';
    2.给保留关键字加反引号(英文状态下,1左边的按键即为反引号)
    UPDATE configuration c SET `value` = 7 where `key` ='extendDays';
    因此不建议使用保留关键字作为数据库名、表名、字段名

    常见的保留关键字百度就能查到很多,查看一下,看看你的报错语句是不是也和保留关键字冲突了

    详解、常见的保留关键(推荐):https://www.jb51.net/article/109501.html

    本文转自:https://blog.csdn.net/weixin_42591904/article/details/85100775

  • 相关阅读:
    CSS中的单位简介
    grid-layout
    position
    form
    objects
    个人介绍
    第十二周作业:
    第十一周作业
    第十周web作业
    第九周作业
  • 原文地址:https://www.cnblogs.com/minmin123/p/14314367.html
Copyright © 2011-2022 走看看