小言_互联网的博客

MySQL保留字

293人阅读  评论(0)

MySQL保留字

MySQL中的保留字和Java中的保留字一样,在命名时不能使用保留字,所以对于MySQL中的保留字要有个大概的印象,下文自https://dev.mysql.com/doc/refman/5.7/en/keywords.html#获取,如有需要可以到官网查看详情。

以下列表显示了My SQL 5.7中的关键字和保留单词,以及不同版本对单个单词的更改。保留关键字用(R)标记。此外,保留FILENAME。

在某些时候,您可能会升级到更高的版本,因此,查看未来的保留字也是一个好主意。您可以在包含更高版本My SQL的手册中找到这些。标准SQL禁止列表中的大多数保留字作为列或表名(例如,GROUP)。保留了一些,因为我的SQL需要它们并使用yacc解析器。

A

  • ACCESSIBLE ®
  • ACCOUNT; added in 5.7.6 (nonreserved)
  • ACTION
  • ADD ®
  • AFTER
  • AGAINST
  • AGGREGATE
  • ALGORITHM
  • ALL ®
  • ALTER ®
  • ALWAYS; added in 5.7.6 (nonreserved)
  • ANALYSE
  • ANALYZE ®
  • AND ®
  • ANY
  • AS ®
  • ASC ®
  • ASCII
  • ASENSITIVE ®
  • AT
  • AUTOEXTEND_SIZE
  • AUTO_INCREMENT
  • AVG
  • AVG_ROW_LENGTH

B

  • BACKUP
  • BEFORE ®
  • BEGIN
  • BETWEEN ®
  • BIGINT ®
  • BINARY ®
  • BINLOG
  • BIT
  • BLOB ®
  • BLOCK
  • BOOL
  • BOOLEAN
  • BOTH ®
  • BTREE
  • BY ®
  • BYTE

C

  • CACHE
  • CALL ®
  • CASCADE ®
  • CASCADED
  • CASE ®
  • CATALOG_NAME
  • CHAIN
  • CHANGE ®
  • CHANGED
  • CHANNEL; added in 5.7.6 (nonreserved)
  • 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; added in 5.7.8 (nonreserved)
  • 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

D

  • 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

E

  • EACH ®
  • ELSE ®
  • ELSEIF ®
  • ENABLE
  • ENCLOSED ®
  • ENCRYPTION; added in 5.7.11 (nonreserved)
  • END
  • ENDS
  • ENGINE
  • ENGINES
  • ENUM
  • ERROR
  • ERRORS
  • ESCAPE
  • ESCAPED ®
  • EVENT
  • EVENTS
  • EVERY
  • EXCHANGE
  • EXECUTE
  • EXISTS ®
  • EXIT ®
  • EXPANSION
  • EXPIRE
  • EXPLAIN ®
  • EXPORT
  • EXTENDED
  • EXTENT_SIZE

F

  • FALSE ®
  • FAST
  • FAULTS
  • FETCH ®
  • FIELDS
  • FILE
  • FILE_BLOCK_SIZE; added in 5.7.6 (nonreserved)
  • FILTER; added in 5.7.3 (nonreserved)
  • FIRST
  • FIXED
  • FLOAT ®
  • FLOAT4 ®
  • FLOAT8 ®
  • FLUSH
  • FOLLOWS; added in 5.7.2 (nonreserved)
  • FOR ®
  • FORCE ®
  • FOREIGN ®
  • FORMAT
  • FOUND
  • FROM ®
  • FULL
  • FULLTEXT ®
  • FUNCTION

G

  • GENERAL
  • GENERATED ®; added in 5.7.6 (reserved)
  • GEOMETRY
  • GEOMETRYCOLLECTION
  • GET ®
  • GET_FORMAT
  • GLOBAL
  • GRANT ®
  • GRANTS
  • GROUP ®
  • GROUP_REPLICATION; added in 5.7.6 (nonreserved)

H

  • HANDLER
  • HASH
  • HAVING ®
  • HELP
  • HIGH_PRIORITY ®
  • HOST
  • HOSTS
  • HOUR
  • HOUR_MICROSECOND ®
  • HOUR_MINUTE ®
  • HOUR_SECOND ®

I

  • IDENTIFIED
  • IF ®
  • IGNORE ®
  • IGNORE_SERVER_IDS
  • IMPORT
  • IN ®
  • INDEX ®
  • INDEXES
  • INFILE ®
  • INITIAL_SIZE
  • INNER ®
  • INOUT ®
  • INSENSITIVE ®
  • INSERT ®
  • INSERT_METHOD
  • INSTALL
  • INSTANCE; added in 5.7.11 (nonreserved)
  • INT ®
  • INT1 ®
  • INT2 ®
  • INT3 ®
  • INT4 ®
  • INT8 ®
  • INTEGER ®
  • INTERVAL ®
  • INTO ®
  • INVOKER
  • IO
  • IO_AFTER_GTIDS ®
  • IO_BEFORE_GTIDS ®
  • IO_THREAD
  • IPC
  • IS ®
  • ISOLATION
  • ISSUER
  • ITERATE ®

J

  • JOIN ®
  • JSON; added in 5.7.8 (nonreserved)

K

  • KEY ®
  • KEYS ®
  • KEY_BLOCK_SIZE
  • KILL ®

L

  • 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 ®

M

  • 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; added in 5.7.10 (nonreserved)
  • MASTER_USER
  • MATCH ®
  • MAXVALUE ®
  • MAX_CONNECTIONS_PER_HOUR
  • MAX_QUERIES_PER_HOUR
  • MAX_ROWS
  • MAX_SIZE
  • MAX_STATEMENT_TIME; added in 5.7.4 (nonreserved); removed in 5.7.8
  • 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

N

  • NAME
  • NAMES
  • NATIONAL
  • NATURAL ®
  • NCHAR
  • NDB
  • NDBCLUSTER
  • NEVER; added in 5.7.4 (nonreserved)
  • NEW
  • NEXT
  • NO
  • NODEGROUP
  • NONBLOCKING; removed in 5.7.6
  • NONE
  • NOT ®
  • NO_WAIT
  • NO_WRITE_TO_BINLOG ®
  • NULL ®
  • NUMBER
  • NUMERIC ®
  • NVARCHAR

O

  • OFFSET
  • OLD_PASSWORD; removed in 5.7.5
  • ON ®
  • ONE
  • ONLY
  • OPEN
  • OPTIMIZE ®
  • OPTIMIZER_COSTS ®; added in 5.7.5 (reserved)
  • OPTION ®
  • OPTIONALLY ®
  • OPTIONS
  • OR ®
  • ORDER ®
  • OUT ®
  • OUTER ®
  • OUTFILE ®
  • OWNER

P

  • PACK_KEYS
  • PAGE
  • PARSER
  • PARSE_GCOL_EXPR; added in 5.7.6 (reserved); became nonreserved in 5.7.8
  • PARTIAL
  • PARTITION ®
  • PARTITIONING
  • PARTITIONS
  • PASSWORD
  • PHASE
  • PLUGIN
  • PLUGINS
  • PLUGIN_DIR
  • POINT
  • POLYGON
  • PORT
  • PRECEDES; added in 5.7.2 (nonreserved)
  • PRECISION ®
  • PREPARE
  • PRESERVE
  • PREV
  • PRIMARY ®
  • PRIVILEGES
  • PROCEDURE ®
  • PROCESSLIST
  • PROFILE
  • PROFILES
  • PROXY
  • PURGE ®

Q

  • QUARTER
  • QUERY
  • QUICK

R

  • 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; added in 5.7.3 (nonreserved)
  • REPLICATE_DO_TABLE; added in 5.7.3 (nonreserved)
  • REPLICATE_IGNORE_DB; added in 5.7.3 (nonreserved)
  • REPLICATE_IGNORE_TABLE; added in 5.7.3 (nonreserved)
  • REPLICATE_REWRITE_DB; added in 5.7.3 (nonreserved)
  • REPLICATE_WILD_DO_TABLE; added in 5.7.3 (nonreserved)
  • REPLICATE_WILD_IGNORE_TABLE; added in 5.7.3 (nonreserved)
  • REPLICATION
  • REQUIRE ®
  • RESET
  • RESIGNAL ®
  • RESTORE
  • RESTRICT ®
  • RESUME
  • RETURN ®
  • RETURNED_SQLSTATE
  • RETURNS
  • REVERSE
  • REVOKE ®
  • RIGHT ®
  • RLIKE ®
  • ROLLBACK
  • ROLLUP
  • ROTATE; added in 5.7.11 (nonreserved)
  • ROUTINE
  • ROW
  • ROWS
  • ROW_COUNT
  • ROW_FORMAT
  • RTREE

S

  • 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 ®; added in 5.7.6 (reserved)
  • STRAIGHT_JOIN ®
  • STRING
  • SUBCLASS_ORIGIN
  • SUBJECT
  • SUBPARTITION
  • SUBPARTITIONS
  • SUPER
  • SUSPEND
  • SWAPS
  • SWITCHES

T

  • 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

U

  • 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; added in 5.7.5 (nonreserved)
  • VALUE
  • VALUES ®
  • VARBINARY ®
  • VARCHAR ®
  • VARCHARACTER ®
  • VARIABLES
  • VARYING ®
  • VIEW
  • VIRTUAL ®; added in 5.7.6 (reserved)

W

  • WAIT
  • WARNINGS
  • WEEK
  • WEIGHT_STRING
  • WHEN ®
  • WHERE ®
  • WHILE ®
  • WITH ®
  • WITHOUT; added in 5.7.5 (nonreserved)
  • WORK
  • WRAPPER
  • WRITE ®

X

  • X509
  • XA
  • XID; added in 5.7.5 (nonreserved)
  • XML
  • XOR ®

Y

  • YEAR
  • YEAR_MONTH ®

Z

  • ZEROFILL ®

MySQL 5.7 New Keywords and Reserved Words

The following list shows the keywords and reserved words that are added in MySQL 5.7, compared to MySQL 5.6. Reserved keywords are marked with ®.

A | C | E | F | G | I | J | M | N | O | P | R | S | V | W | X

A

  • ACCOUNT
  • ALWAYS

C

  • CHANNEL
  • COMPRESSION

E

  • ENCRYPTION

F

  • FILE_BLOCK_SIZE
  • FILTER
  • FOLLOWS

G

  • GENERATED ®
  • GROUP_REPLICATION

I

  • INSTANCE

J

  • JSON

M

  • MASTER_TLS_VERSION

N

  • NEVER

O

  • OPTIMIZER_COSTS ®

P

  • PARSE_GCOL_EXPR
  • PRECEDES

R

  • REPLICATE_DO_DB
  • REPLICATE_DO_TABLE
  • REPLICATE_IGNORE_DB
  • REPLICATE_IGNORE_TABLE
  • REPLICATE_REWRITE_DB
  • REPLICATE_WILD_DO_TABLE
  • REPLICATE_WILD_IGNORE_TABLE
  • ROTATE

S

  • STACKED
  • STORED ®

V

  • VALIDATION
  • VIRTUAL ®

W

  • WITHOUT

X

  • XID

转载:https://blog.csdn.net/qq_45464872/article/details/128390225
查看评论
* 以上用户言论只代表其个人观点,不代表本网站的观点或立场