MySQL字段命名不能使用的MySQL关键字

#今天遇到一个问题,把某一字段重新命名为condition时报错,于是联想到可能是MySQL的关键字,用“引起来后,问题解决。

#在MySQL数据库中,Table字段不能使用MySQL关键字;

#【如果非要使用这些关键字,则需要在关键前后添加 `keyword` 反引号以示区分】

#MySQL允许部分关键字用做未引起来的识别符,因为许多人以前曾使用过它们。

#像name,type 这种常用的字段,MySQL 做了一些处理 name 不报错 type 报错;

#常用字段跟 MySQL 关键字冲突的解决方法:

#键盘1左边的反引号括起来,即以`name`的形式括;

 

# mysql关键字有以下这些:

ADDALLALTER
ANALYZEANDAS
ASCASENSITIVEBEFORE
BETWEENBIGINTBINARY
BLOBBOTHBY
CALLCASCADECASE
CHANGECHARCHARACTER
CHECKCOLLATECOLUMN
CONDITIONCONNECTIONCONSTRAINT
CONTINUECONVERTCREATE
CROSSCURRENT_DATECURRENT_TIME
CURRENT_TIMESTAMPCURRENT_USERCURSOR
DATABASEDATABASESDAY_HOUR
DAY_MICROSECONDDAY_MINUTEDAY_SECOND
DECDECIMALDECLARE
DEFAULTDELAYEDDELETE
DESCDESCRIBEDETERMINISTIC
DISTINCTDISTINCTROWDIV
DOUBLEDROPDUAL
EACHELSEELSEIF
ENCLOSEDESCAPEDEXISTS
EXITEXPLAINFALSE
FETCHFLOATFLOAT4
FLOAT8FORFORCE
FOREIGNFROMFULLTEXT
GOTOGRANTGROUP
HAVINGHIGH_PRIORITYHOUR_MICROSECOND
HOUR_MINUTEHOUR_SECONDIF
IGNOREININDEX
INFILEINNERINOUT
INSENSITIVEINSERTINT
INT1INT2INT3
INT4INT8INTEGER
INTERVALINTOIS
ITERATEJOINKEY
KEYSKILLLABEL
LEADINGLEAVELEFT
LIKELIMITLINEAR
LINESLOADLOCALTIME
LOCALTIMESTAMPLOCKLONG
LONGBLOBLONGTEXTLOOP
LOW_PRIORITYMATCHMEDIUMBLOB
MEDIUMINTMEDIUMTEXTMIDDLEINT
MINUTE_MICROSECONDMINUTE_SECONDMOD
MODIFIESNATURALNOT
NO_WRITE_TO_BINLOGNULLNUMERIC
ONOPTIMIZEOPTION
OPTIONALLYORORDER
OUTOUTEROUTFILE
PRECISIONPRIMARYPROCEDURE
PURGERAID0RANGE
READREADSREAL
REFERENCESREGEXPRELEASE
RENAMEREPEATREPLACE
REQUIRERESTRICTRETURN
REVOKERIGHTRLIKE
SCHEMASCHEMASSECOND_MICROSECOND
SELECTSENSITIVESEPARATOR
SETSHOWSMALLINT
SPATIALSPECIFICSQL
SQLEXCEPTIONSQLSTATESQLWARNING
SQL_BIG_RESULTSQL_CALC_FOUND_ROWSSQL_SMALL_RESULT
SSLSTARTINGSTRAIGHT_JOIN
TABLETERMINATEDTHEN
TINYBLOBTINYINTTINYTEXT
TOTRAILINGTRIGGER
TRUEUNDOUNION
UNIQUEUNLOCKUNSIGNED
UPDATEUSAGEUSE
USINGUTC_DATEUTC_TIME
UTC_TIMESTAMPVALUESVARBINARY
VARCHARVARCHARACTERVARYING
WHENWHEREWHILE
WITHWRITEX509
XORYEAR_MONTH

ZEROFILL

 

 

 

 

 

 

 

 

 

 

 

    原文作者:mysql
    原文地址: https://www.cnblogs.com/xiyouzhi/p/9964661.html
    本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系博主进行删除。
点赞