MySQL 8.0 新增的关键字(Keywords)和保留字(Reserved Words)

MySQL 关键字和保留字通常在SQL语句中有特殊的意义,比如SELECT,DELETE,BIGINT等等,如果要使用这些关键字或者保留字作为表名、字段名,需要使用引号来标识,否则将会报错。

mysql> CREATE TABLE interval (begin INT, end INT); 
ERROR 1064 (42000): You have an error in your SQL syntax ... near 'interval (begin INT, end INT)'

mysql> CREATE TABLE `interval` (begin INT, end INT); 
Query OK, 0 rows affected (0.01 sec)
一、MySQL 8.0 新增的关键字和保留字

带(R)标识的为保留字。

  • ACTIVE
  • ADMIN
  • ARRAY
  • ATTRIBUTE
  • BUCKETS
  • CLONE
  • COMPONENT
  • CUME_DIST (R)
  • DEFINITION
  • DENSE_RANK (R)
  • DESCRIPTION
  • EMPTY (R)
  • ENFORCED
  • ENGINE_ATTRIBUTE
  • EXCEPT (R)
  • EXCLUDE
  • FAILED_LOGIN_ATTEMPTS
  • FIRST_VALUE (R)
  • FOLLOWING
  • GEOMCOLLECTION
  • GET_MASTER_PUBLIC_KEY
  • GROUPING (R)
  • GROUPS (R)
  • HISTOGRAM
  • HISTORY
  • INACTIVE
  • INVISIBLE
  • JSON_TABLE (R)
  • JSON_VALUE
  • LAG (R)
  • LAST_VALUE (R)
  • LATERAL (R)
  • LEAD (R)
  • LOCKED
  • MANAGED
  • MASTER_COMPRESSION_ALGORITH
  • MSMASTER_PUBLIC_KEY_PATH
  • MASTER_TLS_CIPHERSUITES
  • MASTER_ZSTD_COMPRESSION_LEVEL
  • MEMBER
  • NESTED
  • NETWORK_NAMESPACE
  • NOWAIT
  • NTH_VALUE (R)
  • NTILE (R)
  • NULLS
  • OF (R)
  • OFF
  • OJ
  • OLD
  • OPTIONAL
  • ORDINALITY
  • ORGANIZATION
  • OTHERS
  • OVER (R)
  • PASSWORD_LOCK_TIME
  • PATH
  • PERCENT_RANK (R)
  • PERSIST
  • PERSIST_ONLY
  • PRECEDING
  • PRIVILEGE_CHECKS_USER
  • PROCESS
  • RANDOM
  • RANK (R)
  • RECURSIVE (R)
  • REFERENCE
  • REQUIRE_ROW_FORMAT
  • RESOURCE
  • RESPECT
  • RESTART
  • RETAIN
  • RETURNING
  • REUSE
  • ROLE
  • ROW_NUMBER (R)
  • SECONDARY
  • SECONDARY_ENGINE
  • SECONDARY_ENGINE_ATTRIBUTE
  • SECONDARY_LOAD
  • SECONDARY_UNLOAD
  • SKIP
  • SRID
  • STREAM
  • SYSTEM (R)
  • THREAD_PRIORITY
  • TIES
  • TLS
  • UNBOUNDED
  • VCPU
  • VISIBLE
  • WINDOW (R)
二、MySQL 8.0 移除的关键字和保留字
  • ANALYSE
  • DES_KEY_FILE
  • PARSE_GCOL_EXPR
  • REDOFILE
  • SQL_CACHE

完整的MySQL 8.0 关键字和保留字请参考资料:

https://dev.mysql.com/doc/refman/8.0/en/keywords.html

文章评论

0条评论