MySQL保留字不能作为字段名使用_Table字段不能设为关键字range,range在mysql中是分区,是mysql的关键字

x33g5p2x  于2022-05-16 转载在 Mysql  
字(5.6k)|赞(0)|评价(0)|浏览(470)

mysql 中Table字段不能设为关键字range,range在mysql中是分区,是mysql的关键字

在设计MySQL字段的时候,无意中使用InOut这个名称作为字段名称,结果前端提交后就是没有写入数据库!但后端没有任何提示,跟踪mySQL日志,也没有留下痕迹,反复查,不得其解。 后来实在没有办法情况下,之后把表删除,重新手动建一次表,就在再次建表的时候,灵光一现,可能就出在InOut这个名字上,于是改为In_Out,果不出其然,一切OK。 原因是InOut是mySQL的保留字,不能作为字段名。

MySQL保留字如下:

Table 9.2 Keywords and Reserved Words in MySQL 5.7

ACCESSIBLE ®ACCOUNT[a]ACTION
ADD ®AFTERAGAINST
AGGREGATEALGORITHMALL ®
ALTER ®ALWAYS[b]ANALYSE
ANALYZE ®AND ®ANY
AS ®ASC ®ASCII
ASENSITIVE ®ATAUTOEXTEND_SIZE
AUTO_INCREMENTAVGAVG_ROW_LENGTH
BACKUPBEFORE ®BEGIN
BETWEEN ®BIGINT ®BINARY ®
BINLOGBITBLOB ®
BLOCKBOOLBOOLEAN
BOTH ®BTREEBY ®
BYTECACHECALL ®
CASCADE ®CASCADEDCASE ®
CATALOG_NAMECHAINCHANGE ®
CHANGEDCHANNEL[c]CHAR ®
CHARACTER ®CHARSETCHECK ®
CHECKSUMCIPHERCLASS_ORIGIN
CLIENTCLOSECOALESCE
CODECOLLATE ®COLLATION
COLUMN ®COLUMNSCOLUMN_FORMAT
COLUMN_NAMECOMMENTCOMMIT
COMMITTEDCOMPACTCOMPLETION
COMPRESSEDCOMPRESSION[d]CONCURRENT
CONDITION ®CONNECTIONCONSISTENT
CONSTRAINT ®CONSTRAINT_CATALOGCONSTRAINT_NAME
CONSTRAINT_SCHEMACONTAINSCONTEXT
CONTINUE ®CONVERT ®CPU
CREATE ®CROSS ®CUBE
CURRENTCURRENT_DATE ®CURRENT_TIME ®
CURRENT_TIMESTAMP ®CURRENT_USER ®CURSOR ®
CURSOR_NAMEDATADATABASE ®
DATABASES ®DATAFILEDATE
DATETIMEDAYDAY_HOUR ®
DAY_MICROSECOND ®DAY_MINUTE ®DAY_SECOND ®
DEALLOCATEDEC ®DECIMAL ®
DECLARE ®DEFAULT ®DEFAULT_AUTH
DEFINERDELAYED ®DELAY_KEY_WRITE
DELETE ®DESC ®DESCRIBE ®
DES_KEY_FILEDETERMINISTIC ®DIAGNOSTICS
DIRECTORYDISABLEDISCARD
DISKDISTINCT ®DISTINCTROW ®
DIV ®DODOUBLE ®
DROP ®DUAL ®DUMPFILE
DUPLICATEDYNAMICEACH ®
ELSE ®ELSEIF ®ENABLE
ENCLOSED ®ENCRYPTION[e]END
ENDSENGINEENGINES
ENUMERRORERRORS
ESCAPEESCAPED ®EVENT
EVENTSEVERYEXCHANGE
EXECUTEEXISTS ®EXIT ®
EXPANSIONEXPIREEXPLAIN ®
EXPORTEXTENDEDEXTENT_SIZE
FALSE ®FASTFAULTS
FETCH ®FIELDSFILE
FILE_BLOCK_SIZE[f]FILTER[g]FIRST
FIXEDFLOAT ®FLOAT4 ®
FLOAT8 ®FLUSHFOLLOWS[h]
FOR ®FORCE ®FOREIGN ®
FORMATFOUNDFROM ®
FULLFULLTEXT ®FUNCTION
GENERALGENERATED[i] ®GEOMETRY
GEOMETRYCOLLECTIONGET ®GET_FORMAT
GLOBALGRANT ®GRANTS
GROUP ®GROUP_REPLICATION[j]HANDLER
HASHHAVING ®HELP
HIGH_PRIORITY ®HOSTHOSTS
HOURHOUR_MICROSECOND ®HOUR_MINUTE ®
HOUR_SECOND ®IDENTIFIEDIF ®
IGNORE ®IGNORE_SERVER_IDSIMPORT
IN ®INDEX ®INDEXES
INFILE ®INITIAL_SIZEINNER ®
INOUT ®INSENSITIVE ®INSERT ®
INSERT_METHODINSTALLINSTANCE[k]
INT ®INT1 ®INT2 ®
INT3 ®INT4 ®INT8 ®
INTEGER ®INTERVAL ®INTO ®
INVOKERIOIO_AFTER_GTIDS ®
IO_BEFORE_GTIDS ®IO_THREADIPC
IS ®ISOLATIONISSUER
ITERATE ®JOIN ®JSON[l]
KEY ®KEYS ®KEY_BLOCK_SIZE
KILL ®LANGUAGELAST
LEADING ®LEAVE ®LEAVES
LEFT ®LESSLEVEL
LIKE ®LIMIT ®LINEAR ®
LINES ®LINESTRINGLIST
LOAD ®LOCALLOCALTIME ®
LOCALTIMESTAMP ®LOCK ®LOCKS
LOGFILELOGSLONG ®
LONGBLOB ®LONGTEXT ®LOOP ®
LOW_PRIORITY ®MASTERMASTER_AUTO_POSITION
MASTER_BIND ®MASTER_CONNECT_RETRYMASTER_DELAY
MASTER_HEARTBEAT_PERIODMASTER_HOSTMASTER_LOG_FILE
MASTER_LOG_POSMASTER_PASSWORDMASTER_PORT
MASTER_RETRY_COUNTMASTER_SERVER_IDMASTER_SSL
MASTER_SSL_CAMASTER_SSL_CAPATHMASTER_SSL_CERT
MASTER_SSL_CIPHERMASTER_SSL_CRLMASTER_SSL_CRLPATH
MASTER_SSL_KEYMASTER_SSL_VERIFY_SERVER_CERT ®MASTER_TLS_VERSION[m]
MASTER_USERMATCH ®MAXVALUE ®
MAX_CONNECTIONS_PER_HOURMAX_QUERIES_PER_HOURMAX_ROWS
MAX_SIZEMAX_STATEMENT_TIME[n]MAX_UPDATES_PER_HOUR
MAX_USER_CONNECTIONSMEDIUMMEDIUMBLOB ®
MEDIUMINT ®MEDIUMTEXT ®MEMORY
MERGEMESSAGE_TEXTMICROSECOND
MIDDLEINT ®MIGRATEMINUTE
MINUTE_MICROSECOND ®MINUTE_SECOND ®MIN_ROWS
MOD ®MODEMODIFIES ®
MODIFYMONTHMULTILINESTRING
MULTIPOINTMULTIPOLYGONMUTEX
MYSQL_ERRNONAMENAMES
NATIONALNATURAL ®NCHAR
NDBNDBCLUSTERNEVER[o]
NEWNEXTNO
NODEGROUPNONBLOCKING[p]NONE
NOT ®NO_WAITNO_WRITE_TO_BINLOG ®
NULL ®NUMBERNUMERIC ®
NVARCHAROFFSETOLD_PASSWORD[q]
ON ®ONEONLY
OPENOPTIMIZE ®OPTIMIZER_COSTS[r] ®
OPTION ®OPTIONALLY ®OPTIONS
OR ®ORDER ®OUT ®
OUTER ®OUTFILE ®OWNER
PACK_KEYSPAGEPARSER
PARSE_GCOL_EXPR[s]PARTIALPARTITION ®
PARTITIONINGPARTITIONSPASSWORD
PHASEPLUGINPLUGINS
PLUGIN_DIRPOINTPOLYGON
PORTPRECEDES[t]PRECISION ®
PREPAREPRESERVEPREV
PRIMARY ®PRIVILEGESPROCEDURE ®
PROCESSLISTPROFILEPROFILES
PROXYPURGE ®QUARTER
QUERYQUICKRANGE ®
READ ®READS ®READ_ONLY
READ_WRITE ®REAL ®REBUILD
RECOVERREDOFILEREDO_BUFFER_SIZE
REDUNDANTREFERENCES ®REGEXP ®
RELAYRELAYLOGRELAY_LOG_FILE
RELAY_LOG_POSRELAY_THREADRELEASE ®
RELOADREMOVERENAME ®
REORGANIZEREPAIRREPEAT ®
REPEATABLEREPLACE ®REPLICATE_DO_DB[u]
REPLICATE_DO_TABLE[v]REPLICATE_IGNORE_DB[w]REPLICATE_IGNORE_TABLE[x]
REPLICATE_REWRITE_DB[y]REPLICATE_WILD_DO_TABLE[z]REPLICATE_WILD_IGNORE_TABLE[aa]
REPLICATIONREQUIRE ®RESET
RESIGNAL ®RESTORERESTRICT ®
RESUMERETURN ®RETURNED_SQLSTATE
RETURNSREVERSEREVOKE ®
RIGHT ®RLIKE ®ROLLBACK
ROLLUPROTATE[ab]ROUTINE
ROWROWSROW_COUNT
ROW_FORMATRTREESAVEPOINT
SCHEDULESCHEMA ®SCHEMAS ®
SCHEMA_NAMESECONDSECOND_MICROSECOND ®
SECURITYSELECT ®SENSITIVE ®
SEPARATOR ®SERIALSERIALIZABLE
SERVERSESSIONSET ®
SHARESHOW ®SHUTDOWN
SIGNAL ®SIGNEDSIMPLE
SLAVESLOWSMALLINT ®
SNAPSHOTSOCKETSOME
SONAMESOUNDSSOURCE
SPATIAL ®SPECIFIC ®SQL ®
SQLEXCEPTION ®SQLSTATE ®SQLWARNING ®
SQL_AFTER_GTIDSSQL_AFTER_MTS_GAPSSQL_BEFORE_GTIDS
SQL_BIG_RESULT ®SQL_BUFFER_RESULTSQL_CACHE
SQL_CALC_FOUND_ROWS ®SQL_NO_CACHESQL_SMALL_RESULT ®
SQL_THREADSQL_TSI_DAYSQL_TSI_HOUR
SQL_TSI_MINUTESQL_TSI_MONTHSQL_TSI_QUARTER
SQL_TSI_SECONDSQL_TSI_WEEKSQL_TSI_YEAR
SSL ®STACKEDSTART
STARTING ®STARTSSTATS_AUTO_RECALC
STATS_PERSISTENTSTATS_SAMPLE_PAGESSTATUS
STOPSTORAGESTORED[ac] ®
STRAIGHT_JOIN ®STRINGSUBCLASS_ORIGIN
SUBJECTSUBPARTITIONSUBPARTITIONS
SUPERSUSPENDSWAPS
SWITCHESTABLE ®TABLES
TABLESPACETABLE_CHECKSUMTABLE_NAME
TEMPORARYTEMPTABLETERMINATED ®
TEXTTHANTHEN ®
TIMETIMESTAMPTIMESTAMPADD
TIMESTAMPDIFFTINYBLOB ®TINYINT ®
TINYTEXT ®TO ®TRAILING ®
TRANSACTIONTRIGGER ®TRIGGERS
TRUE ®TRUNCATETYPE
TYPESUNCOMMITTEDUNDEFINED
UNDO ®UNDOFILEUNDO_BUFFER_SIZE
UNICODEUNINSTALLUNION ®
UNIQUE ®UNKNOWNUNLOCK ®
UNSIGNED ®UNTILUPDATE ®
UPGRADEUSAGE ®USE ®
USERUSER_RESOURCESUSE_FRM
USING ®UTC_DATE ®UTC_TIME ®
UTC_TIMESTAMP ®VALIDATION[ad]VALUE
VALUES ®VARBINARY ®VARCHAR ®
VARCHARACTER ®VARIABLESVARYING ®
VIEWVIRTUAL[ae] ®WAIT
WARNINGSWEEKWEIGHT_STRING
WHEN ®WHERE ®WHILE ®
WITH ®WITHOUT[af]WORK
WRAPPERWRITE ®X509
XAXID[ag]XML
XOR ®YEARYEAR_MONTH ®
ZEROFILL ®

相关文章

最新文章

更多