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 ® | AFTER | AGAINST |
AGGREGATE | ALGORITHM | ALL ® |
ALTER ® | ALWAYS [b] | ANALYSE |
ANALYZE ® | AND ® | ANY |
AS ® | ASC ® | ASCII |
ASENSITIVE ® | AT | AUTOEXTEND_SIZE |
AUTO_INCREMENT | AVG | AVG_ROW_LENGTH |
BACKUP | BEFORE ® | BEGIN |
BETWEEN ® | BIGINT ® | BINARY ® |
BINLOG | BIT | BLOB ® |
BLOCK | BOOL | BOOLEAN |
BOTH ® | BTREE | BY ® |
BYTE | CACHE | CALL ® |
CASCADE ® | CASCADED | CASE ® |
CATALOG_NAME | CHAIN | CHANGE ® |
CHANGED | CHANNEL [c] | CHAR ® |
CHARACTER ® | CHARSET | CHECK ® |
CHECKSUM | CIPHER | CLASS_ORIGIN |
CLIENT | CLOSE | COALESCE |
CODE | COLLATE ® | COLLATION |
COLUMN ® | COLUMNS | COLUMN_FORMAT |
COLUMN_NAME | COMMENT | COMMIT |
COMMITTED | COMPACT | COMPLETION |
COMPRESSED | COMPRESSION [d] | CONCURRENT |
CONDITION ® | CONNECTION | CONSISTENT |
CONSTRAINT ® | CONSTRAINT_CATALOG | CONSTRAINT_NAME |
CONSTRAINT_SCHEMA | CONTAINS | CONTEXT |
CONTINUE ® | CONVERT ® | CPU |
CREATE ® | CROSS ® | CUBE |
CURRENT | CURRENT_DATE ® | CURRENT_TIME ® |
CURRENT_TIMESTAMP ® | CURRENT_USER ® | CURSOR ® |
CURSOR_NAME | DATA | DATABASE ® |
DATABASES ® | DATAFILE | DATE |
DATETIME | DAY | DAY_HOUR ® |
DAY_MICROSECOND ® | DAY_MINUTE ® | DAY_SECOND ® |
DEALLOCATE | DEC ® | DECIMAL ® |
DECLARE ® | DEFAULT ® | DEFAULT_AUTH |
DEFINER | DELAYED ® | DELAY_KEY_WRITE |
DELETE ® | DESC ® | DESCRIBE ® |
DES_KEY_FILE | DETERMINISTIC ® | DIAGNOSTICS |
DIRECTORY | DISABLE | DISCARD |
DISK | DISTINCT ® | DISTINCTROW ® |
DIV ® | DO | DOUBLE ® |
DROP ® | DUAL ® | DUMPFILE |
DUPLICATE | DYNAMIC | EACH ® |
ELSE ® | ELSEIF ® | ENABLE |
ENCLOSED ® | ENCRYPTION [e] | END |
ENDS | ENGINE | ENGINES |
ENUM | ERROR | ERRORS |
ESCAPE | ESCAPED ® | EVENT |
EVENTS | EVERY | EXCHANGE |
EXECUTE | EXISTS ® | EXIT ® |
EXPANSION | EXPIRE | EXPLAIN ® |
EXPORT | EXTENDED | EXTENT_SIZE |
FALSE ® | FAST | FAULTS |
FETCH ® | FIELDS | FILE |
FILE_BLOCK_SIZE [f] | FILTER [g] | FIRST |
FIXED | FLOAT ® | FLOAT4 ® |
FLOAT8 ® | FLUSH | FOLLOWS [h] |
FOR ® | FORCE ® | FOREIGN ® |
FORMAT | FOUND | FROM ® |
FULL | FULLTEXT ® | FUNCTION |
GENERAL | GENERATED [i] ® | GEOMETRY |
GEOMETRYCOLLECTION | GET ® | GET_FORMAT |
GLOBAL | GRANT ® | GRANTS |
GROUP ® | GROUP_REPLICATION [j] | HANDLER |
HASH | HAVING ® | HELP |
HIGH_PRIORITY ® | HOST | HOSTS |
HOUR | HOUR_MICROSECOND ® | HOUR_MINUTE ® |
HOUR_SECOND ® | IDENTIFIED | IF ® |
IGNORE ® | IGNORE_SERVER_IDS | IMPORT |
IN ® | INDEX ® | INDEXES |
INFILE ® | INITIAL_SIZE | INNER ® |
INOUT ® | INSENSITIVE ® | INSERT ® |
INSERT_METHOD | INSTALL | INSTANCE [k] |
INT ® | INT1 ® | INT2 ® |
INT3 ® | INT4 ® | INT8 ® |
INTEGER ® | INTERVAL ® | INTO ® |
INVOKER | IO | IO_AFTER_GTIDS ® |
IO_BEFORE_GTIDS ® | IO_THREAD | IPC |
IS ® | ISOLATION | ISSUER |
ITERATE ® | JOIN ® | JSON [l] |
KEY ® | KEYS ® | KEY_BLOCK_SIZE |
KILL ® | LANGUAGE | LAST |
LEADING ® | LEAVE ® | LEAVES |
LEFT ® | LESS | LEVEL |
LIKE ® | LIMIT ® | LINEAR ® |
LINES ® | LINESTRING | LIST |
LOAD ® | LOCAL | LOCALTIME ® |
LOCALTIMESTAMP ® | LOCK ® | LOCKS |
LOGFILE | LOGS | LONG ® |
LONGBLOB ® | LONGTEXT ® | LOOP ® |
LOW_PRIORITY ® | MASTER | MASTER_AUTO_POSITION |
MASTER_BIND ® | MASTER_CONNECT_RETRY | MASTER_DELAY |
MASTER_HEARTBEAT_PERIOD | MASTER_HOST | MASTER_LOG_FILE |
MASTER_LOG_POS | MASTER_PASSWORD | MASTER_PORT |
MASTER_RETRY_COUNT | MASTER_SERVER_ID | MASTER_SSL |
MASTER_SSL_CA | MASTER_SSL_CAPATH | MASTER_SSL_CERT |
MASTER_SSL_CIPHER | MASTER_SSL_CRL | MASTER_SSL_CRLPATH |
MASTER_SSL_KEY | MASTER_SSL_VERIFY_SERVER_CERT ® | MASTER_TLS_VERSION [m] |
MASTER_USER | MATCH ® | MAXVALUE ® |
MAX_CONNECTIONS_PER_HOUR | MAX_QUERIES_PER_HOUR | MAX_ROWS |
MAX_SIZE | MAX_STATEMENT_TIME [n] | MAX_UPDATES_PER_HOUR |
MAX_USER_CONNECTIONS | MEDIUM | MEDIUMBLOB ® |
MEDIUMINT ® | MEDIUMTEXT ® | MEMORY |
MERGE | MESSAGE_TEXT | MICROSECOND |
MIDDLEINT ® | MIGRATE | MINUTE |
MINUTE_MICROSECOND ® | MINUTE_SECOND ® | MIN_ROWS |
MOD ® | MODE | MODIFIES ® |
MODIFY | MONTH | MULTILINESTRING |
MULTIPOINT | MULTIPOLYGON | MUTEX |
MYSQL_ERRNO | NAME | NAMES |
NATIONAL | NATURAL ® | NCHAR |
NDB | NDBCLUSTER | NEVER [o] |
NEW | NEXT | NO |
NODEGROUP | NONBLOCKING [p] | NONE |
NOT ® | NO_WAIT | NO_WRITE_TO_BINLOG ® |
NULL ® | NUMBER | NUMERIC ® |
NVARCHAR | OFFSET | OLD_PASSWORD [q] |
ON ® | ONE | ONLY |
OPEN | OPTIMIZE ® | OPTIMIZER_COSTS [r] ® |
OPTION ® | OPTIONALLY ® | OPTIONS |
OR ® | ORDER ® | OUT ® |
OUTER ® | OUTFILE ® | OWNER |
PACK_KEYS | PAGE | PARSER |
PARSE_GCOL_EXPR [s] | PARTIAL | PARTITION ® |
PARTITIONING | PARTITIONS | PASSWORD |
PHASE | PLUGIN | PLUGINS |
PLUGIN_DIR | POINT | POLYGON |
PORT | PRECEDES [t] | PRECISION ® |
PREPARE | PRESERVE | PREV |
PRIMARY ® | PRIVILEGES | PROCEDURE ® |
PROCESSLIST | PROFILE | PROFILES |
PROXY | PURGE ® | QUARTER |
QUERY | QUICK | RANGE ® |
READ ® | READS ® | READ_ONLY |
READ_WRITE ® | REAL ® | REBUILD |
RECOVER | REDOFILE | REDO_BUFFER_SIZE |
REDUNDANT | REFERENCES ® | REGEXP ® |
RELAY | RELAYLOG | RELAY_LOG_FILE |
RELAY_LOG_POS | RELAY_THREAD | RELEASE ® |
RELOAD | REMOVE | RENAME ® |
REORGANIZE | REPAIR | REPEAT ® |
REPEATABLE | REPLACE ® | 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] |
REPLICATION | REQUIRE ® | RESET |
RESIGNAL ® | RESTORE | RESTRICT ® |
RESUME | RETURN ® | RETURNED_SQLSTATE |
RETURNS | REVERSE | REVOKE ® |
RIGHT ® | RLIKE ® | ROLLBACK |
ROLLUP | ROTATE [ab] | ROUTINE |
ROW | ROWS | ROW_COUNT |
ROW_FORMAT | RTREE | SAVEPOINT |
SCHEDULE | SCHEMA ® | SCHEMAS ® |
SCHEMA_NAME | SECOND | SECOND_MICROSECOND ® |
SECURITY | SELECT ® | SENSITIVE ® |
SEPARATOR ® | SERIAL | SERIALIZABLE |
SERVER | SESSION | SET ® |
SHARE | SHOW ® | SHUTDOWN |
SIGNAL ® | SIGNED | SIMPLE |
SLAVE | SLOW | SMALLINT ® |
SNAPSHOT | SOCKET | SOME |
SONAME | SOUNDS | SOURCE |
SPATIAL ® | SPECIFIC ® | SQL ® |
SQLEXCEPTION ® | SQLSTATE ® | SQLWARNING ® |
SQL_AFTER_GTIDS | SQL_AFTER_MTS_GAPS | SQL_BEFORE_GTIDS |
SQL_BIG_RESULT ® | SQL_BUFFER_RESULT | SQL_CACHE |
SQL_CALC_FOUND_ROWS ® | SQL_NO_CACHE | SQL_SMALL_RESULT ® |
SQL_THREAD | SQL_TSI_DAY | SQL_TSI_HOUR |
SQL_TSI_MINUTE | SQL_TSI_MONTH | SQL_TSI_QUARTER |
SQL_TSI_SECOND | SQL_TSI_WEEK | SQL_TSI_YEAR |
SSL ® | STACKED | START |
STARTING ® | STARTS | STATS_AUTO_RECALC |
STATS_PERSISTENT | STATS_SAMPLE_PAGES | STATUS |
STOP | STORAGE | STORED [ac] ® |
STRAIGHT_JOIN ® | STRING | SUBCLASS_ORIGIN |
SUBJECT | SUBPARTITION | SUBPARTITIONS |
SUPER | SUSPEND | SWAPS |
SWITCHES | TABLE ® | TABLES |
TABLESPACE | TABLE_CHECKSUM | TABLE_NAME |
TEMPORARY | TEMPTABLE | TERMINATED ® |
TEXT | THAN | THEN ® |
TIME | TIMESTAMP | TIMESTAMPADD |
TIMESTAMPDIFF | TINYBLOB ® | TINYINT ® |
TINYTEXT ® | TO ® | TRAILING ® |
TRANSACTION | TRIGGER ® | TRIGGERS |
TRUE ® | TRUNCATE | TYPE |
TYPES | UNCOMMITTED | UNDEFINED |
UNDO ® | UNDOFILE | UNDO_BUFFER_SIZE |
UNICODE | UNINSTALL | UNION ® |
UNIQUE ® | UNKNOWN | UNLOCK ® |
UNSIGNED ® | UNTIL | UPDATE ® |
UPGRADE | USAGE ® | USE ® |
USER | USER_RESOURCES | USE_FRM |
USING ® | UTC_DATE ® | UTC_TIME ® |
UTC_TIMESTAMP ® | VALIDATION [ad] | VALUE |
VALUES ® | VARBINARY ® | VARCHAR ® |
VARCHARACTER ® | VARIABLES | VARYING ® |
VIEW | VIRTUAL [ae] ® | WAIT |
WARNINGS | WEEK | WEIGHT_STRING |
WHEN ® | WHERE ® | WHILE ® |
WITH ® | WITHOUT [af] | WORK |
WRAPPER | WRITE ® | X509 |
XA | XID [ag] | XML |
XOR ® | YEAR | YEAR_MONTH ® |
ZEROFILL ® |
版权说明 : 本文为转载文章, 版权归原作者所有 版权申明
原文链接 : https://lebron.blog.csdn.net/article/details/124791394
内容来源于网络,如有侵权,请联系作者删除!