MySQL保留字不能作为字段名使用
在设计MySQL字段的时候,无意中使用InOut这个名称作为字段名称,结果前端提交后就是没有写入数据库!但后端没有任何提示,跟踪mySQL日志,也没有留下痕迹,反复查,不得其解。 后来实在没有办法情况下,之后把表删除,重新手动建一次表,就在再次建表的时候,灵光一现,可能就出在InOut这个名字上,于是改为In_Out,果不出其然,一切OK。 原因是InOut是mySQL的保留字,不能作为字段名。
MySQL保留字如下:
Table 9.2 Keywords and Reserved Words in MySQL 5.7
ACCESSIBLE (R) |
ACCOUNT [a] |
ACTION |
ADD (R) |
AFTER |
AGAINST |
AGGREGATE |
ALGORITHM |
ALL (R) |
ALTER (R) |
ALWAYS [b] |
ANALYSE |
ANALYZE (R) |
AND (R) |
ANY |
AS (R) |
ASC (R) |
ASCII |
ASENSITIVE (R) |
AT |
AUTOEXTEND_SIZE |
AUTO_INCREMENT |
AVG |
AVG_ROW_LENGTH |
BACKUP |
BEFORE (R) |
BEGIN |
BETWEEN (R) |
BIGINT (R) |
BINARY (R) |
BINLOG |
BIT |
BLOB (R) |
BLOCK |
BOOL |
BOOLEAN |
BOTH (R) |
BTREE |
BY (R) |
BYTE |
CACHE |
CALL (R) |
CASCADE (R) |
CASCADED |
CASE (R) |
CATALOG_NAME |
CHAIN |
CHANGE (R) |
CHANGED |
CHANNEL [c] |
CHAR (R) |
CHARACTER (R) |
CHARSET |
CHECK (R) |
CHECKSUM |
CIPHER |
CLASS_ORIGIN |
CLIENT |
CLOSE |
COALESCE |
CODE |
COLLATE (R) |
COLLATION |
COLUMN (R) |
COLUMNS |
COLUMN_FORMAT |
COLUMN_NAME |
COMMENT |
COMMIT |
COMMITTED |
COMPACT |
COMPLETION |
COMPRESSED |
COMPRESSION [d] |
CONCURRENT |
CONDITION (R) |
CONNECTION |
CONSISTENT |
CONSTRAINT (R) |
CONSTRAINT_CATALOG |
CONSTRAINT_NAME |
CONSTRAINT_SCHEMA |
CONTAINS |
CONTEXT |
CONTINUE (R) |
CONVERT (R) |
CPU |
CREATE (R) |
CROSS (R) |
CUBE |
CURRENT |
CURRENT_DATE (R) |
CURRENT_TIME (R) |
CURRENT_TIMESTAMP (R) |
CURRENT_USER (R) |
CURSOR (R) |
CURSOR_NAME |
DATA |
DATABASE (R) |
DATABASES (R) |
DATAFILE |
DATE |
DATETIME |
DAY |
DAY_HOUR (R) |
DAY_MICROSECOND (R) |
DAY_MINUTE (R) |
DAY_SECOND (R) |
DEALLOCATE |
DEC (R) |
DECIMAL (R) |
DECLARE (R) |
DEFAULT (R) |
DEFAULT_AUTH |
DEFINER |
DELAYED (R) |
DELAY_KEY_WRITE |
DELETE (R) |
DESC (R) |
DESCRIBE (R) |
DES_KEY_FILE |
DETERMINISTIC (R) |
DIAGNOSTICS |
DIRECTORY |
DISABLE |
DISCARD |
DISK |
DISTINCT (R) |
DISTINCTROW (R) |
DIV (R) |
DO |
DOUBLE (R) |
DROP (R) |
DUAL (R) |
DUMPFILE |
DUPLICATE |
DYNAMIC |
EACH (R) |
ELSE (R) |
ELSEIF (R) |
ENABLE |
ENCLOSED (R) |
ENCRYPTION [e] |
END |
ENDS |
ENGINE |
ENGINES |
ENUM |
ERROR |
ERRORS |
ESCAPE |
ESCAPED (R) |
EVENT |
EVENTS |
EVERY |
EXCHANGE |
EXECUTE |
EXISTS (R) |
EXIT (R) |
EXPANSION |
EXPIRE |
EXPLAIN (R) |
EXPORT |
EXTENDED |
EXTENT_SIZE |
FALSE (R) |
FAST |
FAULTS |
FETCH (R) |
FIELDS |
FILE |
FILE_BLOCK_SIZE [f] |
FILTER [g] |
FIRST |
FIXED |
FLOAT (R) |
FLOAT4 (R) |
FLOAT8 (R) |
FLUSH |
FOLLOWS [h] |
FOR (R) |
FORCE (R) |
FOREIGN (R) |
FORMAT |
FOUND |
FROM (R) |
FULL |
FULLTEXT (R) |
FUNCTION |
GENERAL |
GENERATED [i] (R) |
GEOMETRY |
GEOMETRYCOLLECTION |
GET (R) |
GET_FORMAT |
GLOBAL |
GRANT (R) |
GRANTS |
GROUP (R) |
GROUP_REPLICATION [j] |
HANDLER |
HASH |
HAVING (R) |
HELP |
HIGH_PRIORITY (R) |
HOST |
HOSTS |
HOUR |
HOUR_MICROSECOND (R) |
HOUR_MINUTE (R) |
HOUR_SECOND (R) |
IDENTIFIED |
IF (R) |
IGNORE (R) |
IGNORE_SERVER_IDS |
IMPORT |
IN (R) |
INDEX (R) |
INDEXES |
INFILE (R) |
INITIAL_SIZE |
INNER (R) |
INOUT (R) |
INSENSITIVE (R) |
INSERT (R) |
INSERT_METHOD |
INSTALL |
INSTANCE [k] |
INT (R) |
INT1 (R) |
INT2 (R) |
INT3 (R) |
INT4 (R) |
INT8 (R) |
INTEGER (R) |
INTERVAL (R) |
INTO (R) |
INVOKER |
IO |
IO_AFTER_GTIDS (R) |
IO_BEFORE_GTIDS (R) |
IO_THREAD |
IPC |
IS (R) |
ISOLATION |
ISSUER |
ITERATE (R) |
JOIN (R) |
JSON [l] |
KEY (R) |
KEYS (R) |
KEY_BLOCK_SIZE |
KILL (R) |
LANGUAGE |
LAST |
LEADING (R) |
LEAVE (R) |
LEAVES |
LEFT (R) |
LESS |
LEVEL |
LIKE (R) |
LIMIT (R) |
LINEAR (R) |
LINES (R) |
LINESTRING |
LIST |
LOAD (R) |
LOCAL |
LOCALTIME (R) |
LOCALTIMESTAMP (R) |
LOCK (R) |
LOCKS |
LOGFILE |
LOGS |
LONG (R) |
LONGBLOB (R) |
LONGTEXT (R) |
LOOP (R) |
LOW_PRIORITY (R) |
MASTER |
MASTER_AUTO_POSITION |
MASTER_BIND (R) |
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 (R) |
MASTER_TLS_VERSION [m] |
MASTER_USER |
MATCH (R) |
MAXVALUE (R) |
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 (R) |
MEDIUMINT (R) |
MEDIUMTEXT (R) |
MEMORY |
MERGE |
MESSAGE_TEXT |
MICROSECOND |
MIDDLEINT (R) |
MIGRATE |
MINUTE |
MINUTE_MICROSECOND (R) |
MINUTE_SECOND (R) |
MIN_ROWS |
MOD (R) |
MODE |
MODIFIES (R) |
MODIFY |
MONTH |
MULTILINESTRING |
MULTIPOINT |
MULTIPOLYGON |
MUTEX |
MYSQL_ERRNO |
NAME |
NAMES |
NATIONAL |
NATURAL (R) |
NCHAR |
NDB |
NDBCLUSTER |
NEVER [o] |
NEW |
NEXT |
NO |
NODEGROUP |
NONBLOCKING [p] |
NONE |
NOT (R) |
NO_WAIT |
NO_WRITE_TO_BINLOG (R) |
NULL (R) |
NUMBER |
NUMERIC (R) |
NVARCHAR |
OFFSET |
OLD_PASSWORD [q] |
ON (R) |
ONE |
ONLY |
OPEN |
OPTIMIZE (R) |
OPTIMIZER_COSTS [r] (R) |
OPTION (R) |
OPTIONALLY (R) |
OPTIONS |
OR (R) |
ORDER (R) |
OUT (R) |
OUTER (R) |
OUTFILE (R) |
OWNER |
PACK_KEYS |
PAGE |
PARSER |
PARSE_GCOL_EXPR [s] |
PARTIAL |
PARTITION (R) |
PARTITIONING |
PARTITIONS |
PASSWORD |
PHASE |
PLUGIN |
PLUGINS |
PLUGIN_DIR |
POINT |
POLYGON |
PORT |
PRECEDES [t] |
PRECISION (R) |
PREPARE |
PRESERVE |
PREV |
PRIMARY (R) |
PRIVILEGES |
PROCEDURE (R) |
PROCESSLIST |
PROFILE |
PROFILES |
PROXY |
PURGE (R) |
QUARTER |
QUERY |
QUICK |
RANGE (R) |
READ (R) |
READS (R) |
READ_ONLY |
READ_WRITE (R) |
REAL (R) |
REBUILD |
RECOVER |
REDOFILE |
REDO_BUFFER_SIZE |
REDUNDANT |
REFERENCES (R) |
REGEXP (R) |
RELAY |
RELAYLOG |
RELAY_LOG_FILE |
RELAY_LOG_POS |
RELAY_THREAD |
RELEASE (R) |
RELOAD |
REMOVE |
RENAME (R) |
REORGANIZE |
REPAIR |
REPEAT (R) |
REPEATABLE |
REPLACE (R) |
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 (R) |
RESET |
RESIGNAL (R) |
RESTORE |
RESTRICT (R) |
RESUME |
RETURN (R) |
RETURNED_SQLSTATE |
RETURNS |
REVERSE |
REVOKE (R) |
RIGHT (R) |
RLIKE (R) |
ROLLBACK |
ROLLUP |
ROTATE [ab] |
ROUTINE |
ROW |
ROWS |
ROW_COUNT |
ROW_FORMAT |
RTREE |
SAVEPOINT |
SCHEDULE |
SCHEMA (R) |
SCHEMAS (R) |
SCHEMA_NAME |
SECOND |
SECOND_MICROSECOND (R) |
SECURITY |
SELECT (R) |
SENSITIVE (R) |
SEPARATOR (R) |
SERIAL |
SERIALIZABLE |
SERVER |
SESSION |
SET (R) |
SHARE |
SHOW (R) |
SHUTDOWN |
SIGNAL (R) |
SIGNED |
SIMPLE |
SLAVE |
SLOW |
SMALLINT (R) |
SNAPSHOT |
SOCKET |
SOME |
SONAME |
SOUNDS |
SOURCE |
SPATIAL (R) |
SPECIFIC (R) |
SQL (R) |
SQLEXCEPTION (R) |
SQLSTATE (R) |
SQLWARNING (R) |
SQL_AFTER_GTIDS |
SQL_AFTER_MTS_GAPS |
SQL_BEFORE_GTIDS |
SQL_BIG_RESULT (R) |
SQL_BUFFER_RESULT |
SQL_CACHE |
SQL_CALC_FOUND_ROWS (R) |
SQL_NO_CACHE |
SQL_SMALL_RESULT (R) |
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 (R) |
STACKED |
START |
STARTING (R) |
STARTS |
STATS_AUTO_RECALC |
STATS_PERSISTENT |
STATS_SAMPLE_PAGES |
STATUS |
STOP |
STORAGE |
STORED [ac] (R) |
STRAIGHT_JOIN (R) |
STRING |
SUBCLASS_ORIGIN |
SUBJECT |
SUBPARTITION |
SUBPARTITIONS |
SUPER |
SUSPEND |
SWAPS |
SWITCHES |
TABLE (R) |
TABLES |
TABLESPACE |
TABLE_CHECKSUM |
TABLE_NAME |
TEMPORARY |
TEMPTABLE |
TERMINATED (R) |
TEXT |
THAN |
THEN (R) |
TIME |
TIMESTAMP |
TIMESTAMPADD |
TIMESTAMPDIFF |
TINYBLOB (R) |
TINYINT (R) |
TINYTEXT (R) |
TO (R) |
TRAILING (R) |
TRANSACTION |
TRIGGER (R) |
TRIGGERS |
TRUE (R) |
TRUNCATE |
TYPE |
TYPES |
UNCOMMITTED |
UNDEFINED |
UNDO (R) |
UNDOFILE |
UNDO_BUFFER_SIZE |
UNICODE |
UNINSTALL |
UNION (R) |
UNIQUE (R) |
UNKNOWN |
UNLOCK (R) |
UNSIGNED (R) |
UNTIL |
UPDATE (R) |
UPGRADE |
USAGE (R) |
USE (R) |
USER |
USER_RESOURCES |
USE_FRM |
USING (R) |
UTC_DATE (R) |
UTC_TIME (R) |
UTC_TIMESTAMP (R) |
VALIDATION [ad] |
VALUE |
VALUES (R) |
VARBINARY (R) |
VARCHAR (R) |
VARCHARACTER (R) |
VARIABLES |
VARYING (R) |
VIEW |
VIRTUAL [ae] (R) |
WAIT |
WARNINGS |
WEEK |
WEIGHT_STRING |
WHEN (R) |
WHERE (R) |
WHILE (R) |
WITH (R) |
WITHOUT [af] |
WORK |
WRAPPER |
WRITE (R) |
X509 |
XA |
XID [ag] |
XML |
XOR (R) |
YEAR |
YEAR_MONTH (R) |
ZEROFILL (R) |
MySQL保留字不能作为字段名使用的更多相关文章
- 查询MySQL数据表的字段名和表结构
查询表的字段: -- 查询表的字段名 SELECT COLUMN_NAME -- GROUP_CONCAT('a.', COLUMN_NAME SEPARATOR ',') AS COLUMN_NAM ...
- mysql查询表内所有字段名和备注
select distinct column_name as 字段名,column_comment as 字段备注 from information_schema.columns where tabl ...
- MySql 获取表的字段名
mysql安装成功后可以看到已经存在mysql.information_schema和test这个几个数据库,information_schema库中有一个名为COLUMNS的表,这个表中记录了数据库 ...
- Python 获取MySql某个表所有字段名
在使用python导出数据库中数据的时候,往往除了插入的数据以外,还有表字段等信息需要导出,查阅了资料后发现了2种方法 第一种:在mysql自带的表里查询,这个表保存了每张表的字段信息,可以用pymy ...
- 使用mysql关键字做类字段名报的错,花了我一个钟,坑啊
com.modelsystem.po.ProjectPlan@701faaedHibernate: insert into ld.project_plan (addTime, describe, ex ...
- InvalidDataAccessResourceUsageException:mysql保留字引发的血案
org.springframework.dao.InvalidDataAccessResourceUsageException: could NOT EXECUTE statement; SQL [n ...
- MySQL 表名和字段名不要使用保留字命名
今天测试代码,新建了一张 Order 表,使用的 MySQL 数据库. 插入数据的时候报语法错误,我检查了好几遍,也没看出 SQL 语句哪里有问题,于是从 MyBatis 的日志里拷贝出 SQL 语句 ...
- Mysql字段名与保留字冲突导致的异常解决
一:引言 用hibernate建表时经常遇到的一个异常:Error executing DDL via JDBC Statement 方法: 查看报错sql语句.问题就在这里. 我是表名(字段名)与保 ...
- 关于mysql字段名和保留字冲突的问题
建了个表,有个字段起名为key,结果insert语句报错了,说是sql不对. 原因:字段key和MySQL的保留字冲突了,当mysql的字段名和保留字冲突的时候,sql语句中的字段名需要加上反引号`` ...
随机推荐
- RestTemplate 发送 get 请求使用误区 多个参数传值为null(转载)
首先看一下官方文档是怎么描述的,传递多个值的情况(注意例子中用到的@pathParam,一般要用@queryParam) RestTemplate 实例 @Configuration public c ...
- 【转】分享JavaScript监听全部Ajax请求事件的方法
若Ajax请求是由jQuery的$.ajax发起的,默认情况下可以使用 jQuery的Global Ajax Event Handlers监听到Ajax事件,然而我遇到的却是用原生JavaScript ...
- 013_针对单个pid的cpu/内存/io的资源占用统计
#!/usr/bin/env python import sys import os import subprocess from decimal import Decimal from decima ...
- ESP8266最小系统
http://www.dnsj88.com/Products/esp12f.html https://gitai.me/2017/04/Re-Zero-Starting-in-IoT/
- 你所不知道的ASP.NET Core MVC/WebApi基础系列(二)
前言 好久没冒泡了,算起来估计有快半年没更新博客了,估计是我第一次停更如此之久,人总有懒惰的时候,时间越长越懒惰,但是呢,不学又不行,持续的惰性是不行dei,要不然会被时光所抛弃,技术所淘汰,好吧,进 ...
- 8年,从2D到3D,我的学习之路
Mickey 写了一篇 <一个本科毕业生创业两年的感悟>,从他的视角,总结了我们合作的两年经历. 我也来写一篇,介绍我的学习之路,希望对大家有所帮助,谢谢大家- 我的学习方法 1.直接从0 ...
- django项目外部的脚本文件执行ORM操作,无需配置路由、视图启动django服务
#一.将脚本路径添加到python的sys系统环境变量里 import sys # sys.path.append('c:/Users/Administrator/www/mymac') #第一种.绝 ...
- 【刷题】【LeetCode】007-整数反转-easy
[刷题][LeetCode]总 用动画的形式呈现解LeetCode题目的思路 参考链接-空 007-整数反转 方法: 弹出和推入数字 & 溢出前进行检查 思路: 我们可以一次构建反转整数的一位 ...
- 注意:QQ影音视频压缩时长丢失
客户宣传片发来,高清的,比较大,500多M,需要转成小一点的,放在客户网站上,于是用QQ影音转码压缩下,变成低质量的.如下 一切都很顺利,提示进度100%! 这一切都是电脑自动的,又是提示成功的,千想 ...
- 【学亮编程手记】Spring Cloud三大组件Eureka/Feign/Histrix的原理及使用