记录使用mybatis-plus时遇到的错误

在使用MyBatis-Plus时,可能会遇到`org.springframework.jdbc.BadSqlGrammarException`,通常是由于字段名与MySQL关键字冲突或者驼峰命名导致。避免这类问题的方法是确保字段名不与MySQL关键字重名,使用下划线分隔单词。例如,将`saleCount`改为`sale_count`。此外,了解MySQL8.0的关键字变化也有助于防止冲突。
摘要由CSDN通过智能技术生成

在mybatis-plus中,由于extends BaseMapper,因此我们是不需要手动写sql语句的,因此我们不会遇到语法错误,但是我们可能会遇到下面列举的错误:

(1)org.springframework.jdbc.BadSqlGrammarException:Cause: java.sql.SQLSyntaxErrorException

在这里插入图片描述
出现该异常的原因:数据库中我们设置的字段名称和数据库中的关键字名称重名,需要更改与数据库中关键字重名的字段名称。

MySQL 关键字和保留字汇总(MySQL 8.0)[1]:

MySQL 关键字以及保留字

A
  • ACCESSIBLE ®
  • ACCOUNT
  • ACTION
  • ACTIVE; added in 8.0.14 (nonreserved)
  • ADD ®
  • ADMIN; became nonreserved in 8.0.12
  • AFTER
  • AGAINST
  • AGGREGATE
  • ALGORITHM
  • ALL ®
  • ALTER ®
  • ALWAYS
  • ANALYSE; removed in 8.0.1
  • ANALYZE ®
  • AND ®
  • ANY
  • ARRAY; added in 8.0.17 (reserved); became nonreserved in 8.0.19
  • AS ®
  • ASC ®
  • ASCII
  • ASENSITIVE ®
  • AT
  • ATTRIBUTE; added in 8.0.21 (nonreserved)
  • AUTOEXTEND_SIZE
  • AUTO_INCREMENT
  • AVG
  • AVG_ROW_LENGTH
B
  • BACKUP
  • BEFORE ®
  • BEGIN
  • BETWEEN ®
  • BIGINT ®
  • BINARY ®
  • BINLOG
  • BIT
  • BLOB ®
  • BLOCK
  • BOOL
  • BOOLEAN
  • BOTH ®
  • BTREE
  • BUCKETS; added in 8.0.2 (nonreserved)
  • BY ®
  • BYTE
C
  • CACHE
  • CALL ®
  • CASCADE ®
  • CASCADED
  • CASE ®
  • CATALOG_NAME
  • CHAIN
  • CHANGE ®
  • CHANGED
  • CHANNEL
  • CHAR ®
  • CHARACTER ®
  • CHARSET
  • CHECK ®
  • CHECKSUM
  • CIPHER
  • CLASS_ORIGIN
  • CLIENT
  • CLONE; added in 8.0.3 (nonreserved)
  • CLOSE
  • COALESCE
  • CODE
  • COLLATE ®
  • COLLATION
  • COLUMN ®
  • COLUMNS
  • COLUMN_FORMAT
  • COLUMN_NAME
  • COMMENT
  • COMMIT
  • COMMITTED
  • COMPACT
  • COMPLETION
  • COMPONENT
  • COMPRESSED
  • COMPRESSION
  • CONCURRENT
  • CONDITION ®
  • CONNECTION
  • CONSISTENT
  • CONSTRAINT ®
  • CONSTRAINT_CATALOG
  • CONSTRAINT_NAME
  • CONSTRAINT_SCHEMA
  • CONTAINS
  • CONTEXT
  • CONTINUE ®
  • CONVERT ®
  • CPU
  • CREATE ®
  • CROSS ®
  • CUBE ®; became reserved in 8.0.1
  • CUME_DIST ®; added in 8.0.2 (reserved)
  • CURRENT
  • CURRENT_DATE ®
  • CURRENT_TIME ®
  • CURRENT_TIMESTAMP ®
  • CURRENT_USER ®
  • CURSOR ®
  • CURSOR_NAME
D
  • DATA
  • DATABASE ®
  • DATABASES ®
  • DATAFILE
  • DATE
  • DATETIME
  • DAY
  • DAY_HOUR ®
  • DAY_MICROSECOND ®
  • DAY_MINUTE ®
  • DAY_SECOND ®
  • DEALLOCATE
  • DEC ®
  • DECIMAL ®
  • DECLARE ®
  • DEFAULT ®
  • DEFAULT_AUTH
  • DEFINER
  • DEFINITION; added in 8.0.4 (nonreserved)
  • DELAYED ®
  • DELAY_KEY_WRITE
  • DELETE ®
  • DENSE_RANK ®; added in 8.0.2 (reserved)
  • DESC ®
  • DESCRIBE ®
  • DESCRIPTION; added in 8.0.4 (nonreserved)
  • DES_KEY_FILE; removed in 8.0.3
  • DETERMINISTIC ®
  • DIAGNOSTICS
  • DIRECTORY
  • DISABLE
  • DISCARD
  • DISK
  • DISTINCT ®
  • DISTINCTROW ®
  • DIV ®
  • DO
  • DOUBLE ®
  • DROP ®
  • DUAL ®
  • DUMPFILE
  • DUPLICATE
  • DYNAMIC
E
  • EACH ®
  • ELSE ®
  • ELSEIF ®
  • EMPTY ®; added in 8.0.4 (reserved)
  • ENABLE
  • ENCLOSED ®
  • ENCRYPTION
  • END
  • ENDS
  • ENFORCED; added in 8.0.16 (nonreserved)
  • ENGINE
  • ENGINES
  • ENGINE_ATTRIBUTE; added in 8.0.21 (nonreserved)
  • ENUM
  • ERROR
  • ERRORS
  • ESCAPE
  • ESCAPED ®
  • EVENT
  • EVENTS
  • EVERY
  • EXCEPT ®
  • EXCHANGE
  • EXCLUDE; added in 8.0.2 (nonreserved)
  • EXECUTE
  • EXISTS ®
  • EXIT ®
  • EXPANSION
  • EXPIRE
  • EXPLAIN ®
  • EXPORT
  • EXTENDED
  • EXTENT_SIZE
F
  • FAILED_LOGIN_ATTEMPTS; added in 8.0.19 (nonreserved)
  • FALSE ®
  • FAST
  • FAULTS
  • FETCH ®
  • FIELDS
  • FILE
  • FILE_BLOCK_SIZE
  • FILTER
  • FIRST
  • FIRST_VALUE ®; added in 8.0.2 (reserved)
  • FIXED
  • FLOAT ®
  • FLOAT4 ®
  • FLOAT8 ®
  • FLUSH
  • FOLLOWING; added in 8.0.2 (nonreserved)
  • FOLLOWS
  • FOR ®
  • FORCE ®
  • FOREIGN ®
  • FORMAT
  • FOUND
  • FROM ®
  • FULL
  • FULLTEXT ®
  • FUNCTION ®; became reserved in 8.0.1
G
  • GENERAL
  • GENERATED ®
  • GEOMCOLLECTION; added in 8.0.11 (nonreserved)
  • GEOMETRY
  • GEOMETRYCOLLECTION
  • GET ®
  • GET_FORMAT
  • GET_MASTER_PUBLIC_KEY; added in 8.0.4 (reserved); became nonreserved in 8.0.11
  • GLOBAL
  • GRANT ®
  • GRANTS
  • GROUP ®
  • GROUPING ®; added in 8.0.1 (reserved)
  • GROUPS ®; added in 8.0.2 (reserved)
  • GROUP_REPLICATION
H
  • HANDLER
  • HASH
  • HAVING ®
  • HELP
  • HIGH_PRIORITY ®
  • HISTOGRAM; added in 8.0.2 (nonreserved)
  • HISTORY; added in 8.0.3 (nonreserved)
  • HOST
  • HOSTS
  • HOUR
  • HOUR_MICROSECOND ®
  • HOUR_MINUTE ®
  • HOUR_SECOND ®
I
  • IDENTIFIED
  • IF ®
  • IGNORE ®
  • IGNORE_SERVER_IDS
  • IMPORT
  • IN ®
  • INACTIVE; added in 8.0.14 (nonreserved)
  • INDEX ®
  • INDEXES
  • INFILE ®
  • INITIAL_SIZE
  • INNER ®
  • INOUT ®
  • INSENSITIVE ®
  • INSERT ®
  • INSERT_METHOD
  • INSTALL
  • INSTANCE
  • INT ®
  • INT1 ®
  • INT2 ®
  • INT3 ®
  • INT4 ®
  • INT8 ®
  • INTEGER ®
  • INTERVAL ®
  • INTO ®
  • INVISIBLE
  • INVOKER
  • IO
  • IO_AFTER_GTIDS ®
  • IO_BEFORE_GTIDS ®
  • IO_THREAD
  • IPC
  • IS ®
  • ISOLATION
  • ISSUER
  • ITERATE ®
J
  • JOIN ®
  • JSON
  • JSON_TABLE ®; added in 8.0.4 (reserved)
  • JSON_VALUE; added in 8.0.21 (nonreserved)
K
  • KEY ®
  • KEYS ®
  • KEY_BLOCK_SIZE
  • KILL ®
L
  • LAG ®; added in 8.0.2 (reserved)
  • LANGUAGE
  • LAST
  • LAST_VALUE ®; added in 8.0.2 (reserved)
  • LATERAL ®; added in 8.0.14 (reserved)
  • LEAD ®; added in 8.0.2 (reserved)
  • LEADING ®
  • LEAVE ®
  • LEAVES
  • LEFT ®
  • LESS
  • LEVEL
  • LIKE ®
  • LIMIT ®
  • LINEAR ®
  • LINES ®
  • LINESTRING
  • LIST
  • LOAD ®
  • LOCAL
  • LOCALTIME ®
  • LOCALTIMESTAMP ®
  • LOCK ®
  • LOCKED; added in 8.0.1 (nonreserved)
  • LOCKS
  • LOGFILE
  • LOGS
  • LONG ®
  • LONGBLOB ®
  • LONGTEXT ®
  • LOOP ®
  • LOW_PRIORITY ®
M
  • MASTER
  • MASTER_AUTO_POSITION
  • MASTER_BIND ®
  • MASTER_COMPRESSION_ALGORITHMS; added in 8.0.18 (nonreserved)
  • MASTER_CONNECT_RETRY
  • MASTER_DELAY
  • MASTER_HEARTBEAT_PERIOD
  • MASTER_HOST
  • MASTER_LOG_FILE
  • MASTER_LOG_POS
  • MASTER_PASSWORD
  • MASTER_PORT
  • MASTER_PUBLIC_KEY_PATH; added in 8.0.4 (nonreserved)
  • 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_CIPHERSUITES; added in 8.0.19 (nonreserved)
  • MASTER_TLS_VERSION
  • MASTER_USER
  • MASTER_ZSTD_COMPRESSION_LEVEL; added in 8.0.18 (nonreserved)
  • MATCH ®
  • MAXVALUE ®
  • MAX_CONNECTIONS_PER_HOUR
  • MAX_QUERIES_PER_HOUR
  • MAX_ROWS
  • MAX_SIZE
  • MAX_UPDATES_PER_HOUR
  • MAX_USER_CONNECTIONS
  • MEDIUM
  • MEDIUMBLOB ®
  • MEDIUMINT ®
  • MEDIUMTEXT ®
  • MEMBER; added in 8.0.17 (reserved); became nonreserved in 8.0.19
  • 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
N
  • NAME
  • NAMES
  • NATIONAL
  • NATURAL ®
  • NCHAR
  • NDB
  • NDBCLUSTER
  • NESTED; added in 8.0.4 (nonreserved)
  • NETWORK_NAMESPACE; added in 8.0.16 (nonreserved)
  • NEVER
  • NEW
  • NEXT
  • NO
  • NODEGROUP
  • NONE
  • NOT ®
  • NOWAIT; added in 8.0.1 (nonreserved)
  • NO_WAIT
  • NO_WRITE_TO_BINLOG ®
  • NTH_VALUE ®; added in 8.0.2 (reserved)
  • NTILE ®; added in 8.0.2 (reserved)
  • NULL ®
  • NULLS; added in 8.0.2 (nonreserved)
  • NUMBER
  • NUMERIC ®
  • NVARCHAR
O
  • OF ®; added in 8.0.1 (reserved)
  • OFF; added in 8.0.20 (nonreserved)
  • OFFSET
  • OJ; added in 8.0.16 (nonreserved)
  • OLD; added in 8.0.14 (nonreserved)
  • ON ®
  • ONE
  • ONLY
  • OPEN
  • OPTIMIZE ®
  • OPTIMIZER_COSTS ®
  • OPTION ®
  • OPTIONAL; added in 8.0.13 (nonreserved)
  • OPTIONALLY ®
  • OPTIONS
  • OR ®
  • ORDER ®
  • ORDINALITY; added in 8.0.4 (nonreserved)
  • ORGANIZATION; added in 8.0.4 (nonreserved)
  • OTHERS; added in 8.0.2 (nonreserved)
  • OUT ®
  • OUTER ®
  • OUTFILE ®
  • OVER ®; added in 8.0.2 (reserved)
  • OWNER
P
  • PACK_KEYS
  • PAGE
  • PARSER
  • PARTIAL
  • PARTITION ®
  • PARTITIONING
  • PARTITIONS
  • PASSWORD
  • PASSWORD_LOCK_TIME; added in 8.0.19 (nonreserved)
  • PATH; added in 8.0.4 (nonreserved)
  • PERCENT_RANK ®; added in 8.0.2 (reserved)
  • PERSIST; became nonreserved in 8.0.16
  • PERSIST_ONLY; added in 8.0.2 (reserved); became nonreserved in 8.0.16
  • PHASE
  • PLUGIN
  • PLUGINS
  • PLUGIN_DIR
  • POINT
  • POLYGON
  • PORT
  • PRECEDES
  • PRECEDING; added in 8.0.2 (nonreserved)
  • PRECISION ®
  • PREPARE
  • PRESERVE
  • PREV
  • PRIMARY ®
  • PRIVILEGES
  • PRIVILEGE_CHECKS_USER; added in 8.0.18 (nonreserved)
  • PROCEDURE ®
  • PROCESS; added in 8.0.11 (nonreserved)
  • PROCESSLIST
  • PROFILE
  • PROFILES
  • PROXY
  • PURGE ®
Q
  • QUARTER
  • QUERY
  • QUICK
R
  • RANDOM; added in 8.0.18 (nonreserved)
  • RANGE ®
  • RANK ®; added in 8.0.2 (reserved)
  • READ ®
  • READS ®
  • READ_ONLY
  • READ_WRITE ®
  • REAL ®
  • REBUILD
  • RECOVER
  • RECURSIVE ®; added in 8.0.1 (reserved)
  • REDOFILE; removed in 8.0.3
  • REDO_BUFFER_SIZE
  • REDUNDANT
  • REFERENCE; added in 8.0.4 (nonreserved)
  • REFERENCES ®
  • REGEXP ®
  • RELAY
  • RELAYLOG
  • RELAY_LOG_FILE
  • RELAY_LOG_POS
  • RELAY_THREAD
  • RELEASE ®
  • RELOAD
  • REMOTE; added in 8.0.3 (nonreserved); removed in 8.0.14
  • REMOVE
  • RENAME ®
  • REORGANIZE
  • REPAIR
  • REPEAT ®
  • REPEATABLE
  • REPLACE ®
  • REPLICA; added in 8.0.22 (nonreserved)
  • REPLICAS; added in 8.0.22 (nonreserved)
  • REPLICATE_DO_DB
  • REPLICATE_DO_TABLE
  • REPLICATE_IGNORE_DB
  • REPLICATE_IGNORE_TABLE
  • REPLICATE_REWRITE_DB
  • REPLICATE_WILD_DO_TABLE
  • REPLICATE_WILD_IGNORE_TABLE
  • REPLICATION
  • REQUIRE ®
  • REQUIRE_ROW_FORMAT; added in 8.0.19 (nonreserved)
  • RESET
  • RESIGNAL ®
  • RESOURCE; added in 8.0.3 (nonreserved)
  • RESPECT; added in 8.0.2 (nonreserved)
  • RESTART; added in 8.0.4 (nonreserved)
  • RESTORE
  • RESTRICT ®
  • RESUME
  • RETAIN; added in 8.0.14 (nonreserved)
  • RETURN ®
  • RETURNED_SQLSTATE
  • RETURNING; added in 8.0.21 (nonreserved)
  • RETURNS
  • REUSE; added in 8.0.3 (nonreserved)
  • REVERSE
  • REVOKE ®
  • RIGHT ®
  • RLIKE ®
  • ROLE; became nonreserved in 8.0.1
  • ROLLBACK
  • ROLLUP
  • ROTATE
  • ROUTINE
  • ROW ®; became reserved in 8.0.2
  • ROWS ®; became reserved in 8.0.2
  • ROW_COUNT
  • ROW_FORMAT
  • ROW_NUMBER ®; added in 8.0.2 (reserved)
  • RTREE
S
  • SAVEPOINT
  • SCHEDULE
  • SCHEMA ®
  • SCHEMAS ®
  • SCHEMA_NAME
  • SECOND
  • SECONDARY; added in 8.0.16 (nonreserved)
  • SECONDARY_ENGINE; added in 8.0.13 (nonreserved)
  • SECONDARY_ENGINE_ATTRIBUTE; added in 8.0.21 (nonreserved)
  • SECONDARY_LOAD; added in 8.0.13 (nonreserved)
  • SECONDARY_UNLOAD; added in 8.0.13 (nonreserved)
  • SECOND_MICROSECOND ®
  • SECURITY
  • SELECT ®
  • SENSITIVE ®
  • SEPARATOR ®
  • SERIAL
  • SERIALIZABLE
  • SERVER
  • SESSION
  • SET ®
  • SHARE
  • SHOW ®
  • SHUTDOWN
  • SIGNAL ®
  • SIGNED
  • SIMPLE
  • SKIP; added in 8.0.1 (nonreserved)
  • 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; removed in 8.0.3
  • 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
  • SRID; added in 8.0.3 (nonreserved)
  • SSL ®
  • STACKED
  • START
  • STARTING ®
  • STARTS
  • STATS_AUTO_RECALC
  • STATS_PERSISTENT
  • STATS_SAMPLE_PAGES
  • STATUS
  • STOP
  • STORAGE
  • STORED ®
  • STRAIGHT_JOIN ®
  • STREAM; added in 8.0.20 (nonreserved)
  • STRING
  • SUBCLASS_ORIGIN
  • SUBJECT
  • SUBPARTITION
  • SUBPARTITIONS
  • SUPER
  • SUSPEND
  • SWAPS
  • SWITCHES
  • SYSTEM ®; added in 8.0.3 (reserved)
T
  • TABLE ®
  • TABLES
  • TABLESPACE
  • TABLE_CHECKSUM
  • TABLE_NAME
  • TEMPORARY
  • TEMPTABLE
  • TERMINATED ®
  • TEXT
  • THAN
  • THEN ®
  • THREAD_PRIORITY; added in 8.0.3 (nonreserved)
  • TIES; added in 8.0.2 (nonreserved)
  • TIME
  • TIMESTAMP
  • TIMESTAMPADD
  • TIMESTAMPDIFF
  • TINYBLOB ®
  • TINYINT ®
  • TINYTEXT ®
  • TLS; added in 8.0.21 (nonreserved)
  • TO ®
  • TRAILING ®
  • TRANSACTION
  • TRIGGER ®
  • TRIGGERS
  • TRUE ®
  • TRUNCATE
  • TYPE
  • TYPES
U
  • UNBOUNDED; added in 8.0.2 (nonreserved)
  • 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 ®
V
  • VALIDATION
  • VALUE
  • VALUES ®
  • VARBINARY ®
  • VARCHAR ®
  • VARCHARACTER ®
  • VARIABLES
  • VARYING ®
  • VCPU; added in 8.0.3 (nonreserved)
  • VIEW
  • VIRTUAL ®
  • VISIBLE
W
  • WAIT
  • WARNINGS
  • WEEK
  • WEIGHT_STRING
  • WHEN ®
  • WHERE ®
  • WHILE ®
  • WINDOW ®; added in 8.0.2 (reserved)
  • WITH ®
  • WITHOUT
  • WORK
  • WRAPPER
  • WRITE ®
X
  • X509
  • XA
  • XID
  • XML
  • XOR ®
Y
  • YEAR
  • YEAR_MONTH ®
Z
  • ZEROFILL ®
  • ZONE; added in 8.0.22 (nonreserved)

MySQL 8.0新关键字和保留字

下表显示了与MySQL 5.7相比在MySQL 8.0中添加的关键字和保留字。保留的关键字标有(R)。

A
  • ACTIVE
  • ADMIN
  • ARRAY
  • ATTRIBUTE
B
  • BUCKETS
C
  • CLONE
  • COMPONENT
  • CUME_DIST ®
D
  • DEFINITION
  • DENSE_RANK ®
  • DESCRIPTION
E
  • EMPTY ®
  • ENFORCED
  • ENGINE_ATTRIBUTE
  • EXCEPT ®
  • EXCLUDE
F
  • FAILED_LOGIN_ATTEMPTS
  • FIRST_VALUE ®
  • FOLLOWING
G
  • GEOMCOLLECTION
  • GET_MASTER_PUBLIC_KEY
  • GROUPING ®
  • GROUPS ®
H
  • HISTOGRAM
  • HISTORY
I
  • INACTIVE
  • INVISIBLE
J
  • JSON_TABLE ®
  • JSON_VALUE
L
  • LAG ®
  • LAST_VALUE ®
  • LATERAL ®
  • LEAD ®
  • LOCKED
M
  • MASTER_COMPRESSION_ALGORITHMS
  • MASTER_PUBLIC_KEY_PATH
  • MASTER_TLS_CIPHERSUITES
  • MASTER_ZSTD_COMPRESSION_LEVEL
  • MEMBER
N
  • NESTED
  • NETWORK_NAMESPACE
  • NOWAIT
  • NTH_VALUE ®
  • NTILE ®
  • NULLS
O
  • OF ®
  • OFF
  • OJ
  • OLD
  • OPTIONAL
  • ORDINALITY
  • ORGANIZATION
  • OTHERS
  • OVER ®
P
  • PASSWORD_LOCK_TIME
  • PATH
  • PERCENT_RANK ®
  • PERSIST
  • PERSIST_ONLY
  • PRECEDING
  • PRIVILEGE_CHECKS_USER
  • PROCESS
R
  • RANDOM
  • RANK ®
  • RECURSIVE ®
  • REFERENCE
  • REPLICA
  • REPLICAS
  • REQUIRE_ROW_FORMAT
  • RESOURCE
  • RESPECT
  • RESTART
  • RETAIN
  • RETURNING
  • REUSE
  • ROLE
  • ROW_NUMBER ®
S
  • SECONDARY
  • SECONDARY_ENGINE
  • SECONDARY_ENGINE_ATTRIBUTE
  • SECONDARY_LOAD
  • SECONDARY_UNLOAD
  • SKIP
  • SRID
  • STREAM
  • SYSTEM ®
T
  • THREAD_PRIORITY
  • TIES
  • TLS
U
  • UNBOUNDED
V
  • VCPU
  • VISIBLE
W
  • WINDOW ®
Z
  • ZONE

MySQL 8.0删除了关键字和保留字

下表显示了与MySQL 5.7相比在MySQL 8.0中删除的关键字和保留字。保留的关键字标有(R)。

  • ANALYSE
  • DES_KEY_FILE
  • PARSE_GCOL_EXPR
  • REDOFILE
  • SQL_CACHE

总结,在我们在向数据库中添加字段时,避免字段名称和数据库中的关键字重名

(2)org.springframework.jdbc.BadSqlGrammarException::Error querying database. Cause: java.sql.SQLSyntaxErrorException: Unknown column ‘sale_count’ in ‘field list’

在这里插入图片描述
出现该异常的原因:在使用mybatis-plus时,mysql中字段的名称命名时不能使用驼峰命名,在两个单词之间使用下划线“_”进行分割。

比如上图中的错误,由于数据库中字段名称是saleCount,出现该异常,将该字段名称修改为sale_count即可。

References
[1] 朱朱朱–.(2020). mybatis-plus中遇到org.springframework.jdbc.BadSqlGrammarException. CSDN. URL https://blog.csdn.net/m0_56921622/article/details/122975904.

评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值