reserved words/keywords list
Posted by: Eric Peterson
Date: March 15, 2018 11:09AM

I wrote the following as a tool for my developers. They keep wanting to use reserved words/keywords as table/columns names. I'm trying to break them of that bad habit.

Question:
* Is this complete? I got all these from the online documentation. There is a note that yacc keywords should also be considered. Are they all here?
* Can I get some help to identify when words were added to which version?

Thanks
Eric




-- ========== ========== ========== ========== ========== ========== ==========
-- List of Reserved and Keywords MySQL, as much as I can find.
--
-- Log:
-- 2017-05-09 Eric D Peterson Initial Version
-- 2018-03-14 EDP - Added/Removed for release 8.0
-- - remove currently_valid column
-- ========== ========== ========== ========== ========== ========== ==========


USE DBA; -- or whichever schema you want this in.


-- ---------- ---------- ----------
DROP TABLE IF EXISTS reserved_words;
SHOW WARNINGS;




-- ---------- ---------- ----------
-- consider using utf8mb4/utf8mb4_0900_as_cs once we get to v.8.0
--
-- table should be static and only analyzed if added/modified, so set STATS_AUTO_RECALC to OFF
-- ---------- ---------- ----------
CREATE TABLE IF NOT EXISTS reserved_words (
id SMALLINT UNSIGNED AUTO_INCREMENT PRIMARY KEY,
reserved_word VARCHAR(64) NOT NULL
COMMENT 'Should be capitalized, for convenience for uniqueness and searching',
reserved_type ENUM( 'Keyword', 'Reserved' ) NOT NULL DEFAULT 'Keyword'
COMMENT 'Reserved Words must be back ticked quoted. :( *DO NOT* use them! Just don''t. _Highly_ recommended to not use keywords either.',
note VARCHAR(400)
COMMENT 'A short note about when this row was added, dropped, and/or modified',
CONSTRAINT UNIQUE INDEX reserved_words_uq1 ( reserved_word )
)
ENGINE = InnoDB
COMMENT = 'Reserved and Keywords from MySQL from v.5.1 to 8.0 (using collation utf8_general_ci to avoid error: Illegal mix of collations)'
DEFAULT CHARSET = utf8
DEFAULT COLLATE = utf8_general_ci
STATS_AUTO_RECALC = 0
STATS_PERSISTENT = 1
STATS_SAMPLE_PAGES = 50;
SHOW WARNINGS;




-- ---------- ---------- ----------
INSERT INTO reserved_words
( reserved_word, reserved_type, note )
VALUES
( 'ACCESSIBLE', 'Reserved', NULL ),
( 'ACCOUNT', 'Keyword', 'added in 5.7' ),
( 'ACTION', 'Keyword', NULL ),
( 'ADD', 'Reserved', NULL ),
( 'ADMIN', 'Reserved', 'added in 8.0' ),
( 'AFTER', 'Keyword', NULL ),
( 'AGAINST', 'Keyword', NULL ),
( 'AGGREGATE', 'Keyword', NULL ),
( 'ALGORITHM', 'Keyword', NULL ),
( 'ALL', 'Reserved', NULL ),
( 'ALTER', 'Reserved', NULL ),
( 'ALWAYS', 'Keyword', 'added in 5.7' ),
( 'ANALYSE', 'Keyword', 'added in 5.6.6; removed in 8.0' ),
( 'ANALYZE', 'Reserved', NULL ),
( 'AND', 'Reserved', NULL ),
( 'ANY', 'Keyword', NULL ),
( 'AS', 'Reserved', NULL ),
( 'ASC', 'Reserved', NULL ),
( 'ASCII', 'Keyword', NULL ),
( 'ASENSITIVE', 'Reserved', NULL ),
( 'AT', 'Keyword', NULL ),
( 'AUTHORS', 'Keyword', 'removed in 5.6.8' ),
( 'AUTOEXTEND_SIZE', 'Keyword', NULL ),
( 'AUTO_INCREMENT', 'Keyword', NULL ),
( 'AVG', 'Keyword', NULL ),
( 'AVG_ROW_LENGTH', 'Keyword', NULL ),
( 'BACKUP', 'Keyword', NULL ),
( 'BEFORE', 'Reserved', NULL ),
( 'BEGIN', 'Keyword', NULL ),
( 'BETWEEN', 'Reserved', NULL ),
( 'BIGINT', 'Reserved', NULL ),
( 'BINARY', 'Reserved', NULL ),
( 'BINLOG', 'Keyword', NULL ),
( 'BIT', 'Keyword', NULL ),
( 'BLOB', 'Reserved', NULL ),
( 'BLOCK', 'Keyword', NULL ),
( 'BOOL', 'Keyword', NULL ),
( 'BOOLEAN', 'Keyword', NULL ),
( 'BOTH', 'Reserved', NULL ),
( 'BTREE', 'Keyword', NULL ),
( 'BUCKETS', 'Keyword', 'added in 8.0' ),
( 'BY', 'Reserved', NULL ),
( 'BYTE', 'Keyword', NULL ),
( 'CACHE', 'Keyword', NULL ),
( 'CALL', 'Reserved', NULL ),
( 'CASCADE', 'Reserved', NULL ),
( 'CASCADED', 'Keyword', NULL ),
( 'CASE', 'Reserved', NULL ),
( 'CATALOG_NAME', 'Keyword', NULL ),
( 'CHAIN', 'Keyword', NULL ),
( 'CHANGE', 'Reserved', NULL ),
( 'CHANGED', 'Keyword', NULL ),
( 'CHANNEL', 'Keyword', 'added in 5.7' ),
( 'CHAR', 'Reserved', NULL ),
( 'CHARACTER', 'Reserved', NULL ),
( 'CHARSET', 'Keyword', NULL ),
( 'CHECK', 'Reserved', NULL ),
( 'CHECKSUM', 'Keyword', NULL ),
( 'CIPHER', 'Keyword', NULL ),
( 'CLASS_ORIGIN', 'Keyword', NULL ),
( 'CLIENT', 'Keyword', NULL ),
( 'CLONE', 'Keyword', 'added in 8.0' ),
( 'CLOSE', 'Keyword', NULL ),
( 'COALESCE', 'Keyword', NULL ),
( 'CODE', 'Keyword', NULL ),
( 'COLLATE', 'Reserved', NULL ),
( 'COLLATION', 'Keyword', NULL ),
( 'COLUMN', 'Reserved', NULL ),
( 'COLUMNS', 'Keyword', NULL ),
( 'COLUMN_FORMAT', 'Keyword', 'added in 5.6.6' ),
( 'COLUMN_NAME', 'Keyword', NULL ),
( 'COMMENT', 'Keyword', NULL ),
( 'COMMIT', 'Keyword', NULL ),
( 'COMMITTED', 'Keyword', NULL ),
( 'COMPACT', 'Keyword', NULL ),
( 'COMPLETION', 'Keyword', NULL ),
( 'COMPONENT', 'Keyword', 'added in 8.0' ),
( 'COMPRESSED', 'Keyword', NULL ),
( 'COMPRESSION', 'Keyword', 'added in 5.7' ),
( 'CONCURRENT', 'Keyword', NULL ),
( 'CONDITION', 'Reserved', NULL ),
( 'CONNECTION', 'Keyword', NULL ),
( 'CONSISTENT', 'Keyword', NULL ),
( 'CONSTRAINT', 'Reserved', NULL ),
( 'CONSTRAINT_CATALOG', 'Keyword', NULL ),
( 'CONSTRAINT_NAME', 'Keyword', NULL ),
( 'CONSTRAINT_SCHEMA', 'Keyword', NULL ),
( 'CONTAINS', 'Keyword', NULL ),
( 'CONTEXT', 'Keyword', NULL ),
( 'CONTINUE', 'Reserved', NULL ),
( 'CONTRIBUTORS', 'Keyword', 'removed in 5.6.8' ),
( 'CONVERT', 'Reserved', NULL ),
( 'CPU', 'Keyword', NULL ),
( 'CREATE', 'Reserved', NULL ),
( 'CROSS', 'Reserved', NULL ),
( 'CUBE', 'Keyword', NULL ),
( 'CUME_DIST', 'Reserved', 'added in 8.0' ),
( 'CURRENT', 'Keyword', 'added in 5.6.4' ),
( 'CURRENT_DATE', 'Reserved', NULL ),
( 'CURRENT_TIME', 'Reserved', NULL ),
( 'CURRENT_TIMESTAMP', 'Reserved', NULL ),
( 'CURRENT_USER', 'Reserved', NULL ),
( 'CURSOR', 'Reserved', NULL ),
( 'CURSOR_NAME', 'Keyword', NULL ),
( 'DATA', 'Keyword', NULL ),
( 'DATABASE', 'Reserved', NULL ),
( 'DATABASES', 'Reserved', NULL ),
( 'DATAFILE', 'Keyword', NULL ),
( 'DATE', 'Keyword', NULL ),
( 'DATETIME', 'Keyword', NULL ),
( 'DAY', 'Keyword', NULL ),
( 'DAY_HOUR', 'Reserved', NULL ),
( 'DAY_MICROSECOND', 'Reserved', NULL ),
( 'DAY_MINUTE', 'Reserved', NULL ),
( 'DAY_SECOND', 'Reserved', NULL ),
( 'DEALLOCATE', 'Keyword', NULL ),
( 'DEC', 'Reserved', NULL ),
( 'DECIMAL', 'Reserved', NULL ),
( 'DECLARE', 'Reserved', NULL ),
( 'DEFAULT', 'Reserved', NULL ),
( 'DEFAULT_AUTH', 'Keyword', 'added in 5.6.4' ),
( 'DEFINER', 'Keyword', NULL ),
( 'DEFINITION', 'Keyword', 'added in 8.0' ),
( 'DELAYED', 'Reserved', NULL ),
( 'DELAY_KEY_WRITE', 'Keyword', NULL ),
( 'DELETE', 'Reserved', NULL ),
( 'DENSE_RANK', 'Reserved', 'added in 8.0' ),
( 'DESC', 'Reserved', NULL ),
( 'DESCRIBE', 'Reserved', NULL ),
( 'DESCRIPTION', 'Keyword', 'added in 8.0' ),
( 'DES_KEY_FILE', 'Keyword', 'removed in 8.0' ),
( 'DETERMINISTIC', 'Reserved', NULL ),
( 'DIAGNOSTICS', 'Keyword', 'added in 5.6.4' ),
( 'DIRECTORY', 'Keyword', NULL ),
( 'DISABLE', 'Keyword', NULL ),
( 'DISCARD', 'Keyword', NULL ),
( 'DISK', 'Keyword', NULL ),
( 'DISTINCT', 'Reserved', NULL ),
( 'DISTINCTROW', 'Reserved', NULL ),
( 'DIV', 'Reserved', NULL ),
( 'DO', 'Keyword', NULL ),
( 'DOUBLE', 'Reserved', NULL ),
( 'DROP', 'Reserved', NULL ),
( 'DUAL', 'Reserved', NULL ),
( 'DUMPFILE', 'Keyword', NULL ),
( 'DUPLICATE', 'Keyword', NULL ),
( 'DYNAMIC', 'Keyword', NULL ),
( 'EACH', 'Reserved', NULL ),
( 'ELSE', 'Reserved', NULL ),
( 'ELSEIF', 'Reserved', NULL ),
( 'EMPTY', 'Reserved', 'added in 8.0' ),
( 'ENABLE', 'Keyword', NULL ),
( 'ENCLOSED', 'Reserved', NULL ),
( 'ENCRYPTION', 'Keyword', 'added in 5.7' ),
( 'END', 'Keyword', NULL ),
( 'ENDS', 'Keyword', NULL ),
( 'ENGINE', 'Keyword', NULL ),
( 'ENGINES', 'Keyword', NULL ),
( 'ENUM', 'Keyword', NULL ),
( 'ERROR', 'Keyword', 'added in 5.5.3' ),
( 'ERRORS', 'Keyword', NULL ),
( 'ESCAPE', 'Keyword', NULL ),
( 'ESCAPED', 'Reserved', NULL ),
( 'EVENT', 'Keyword', NULL ),
( 'EVENTS', 'Keyword', NULL ),
( 'EVERY', 'Keyword', NULL ),
( 'EXCEPT', 'Reserved', 'added in 8.0' ),
( 'EXCHANGE', 'Keyword', NULL ),
( 'EXCLUDE', 'Keyword', 'added in 8.0' ),
( 'EXECUTE', 'Keyword', NULL ),
( 'EXISTS', 'Reserved', NULL ),
( 'EXIT', 'Reserved', NULL ),
( 'EXPANSION', 'Keyword', NULL ),
( 'EXPIRE', 'Keyword', 'added in 5.6.6' ),
( 'EXPLAIN', 'Reserved', NULL ),
( 'EXPORT', 'Keyword', 'added in 5.6.6' ),
( 'EXTENDED', 'Keyword', NULL ),
( 'EXTENT_SIZE', 'Keyword', NULL ),
( 'FALSE', 'Reserved', NULL ),
( 'FAST', 'Keyword', NULL ),
( 'FAULTS', 'Keyword', NULL ),
( 'FETCH', 'Reserved', NULL ),
( 'FIELDS', 'Keyword', NULL ),
( 'FILE', 'Keyword', NULL ),
( 'FILE_BLOCK_SIZE', 'Keyword', 'added in 5.7' ),
( 'FILTER', 'Keyword', 'added in 5.7' ),
( 'FIRST', 'Keyword', NULL ),
( 'FIRST_VALUE', 'Reserved', 'added in 8.0' ),
( 'FIXED', 'Keyword', NULL ),
( 'FLOAT', 'Reserved', NULL ),
( 'FLOAT4', 'Reserved', NULL ),
( 'FLOAT8', 'Reserved', NULL ),
( 'FLUSH', 'Keyword', NULL ),
( 'FOLLOWING', 'Keyword', 'added in 8.0' ),
( 'FOLLOWS', 'Keyword', 'added in 5.7' ),
( 'FOR', 'Reserved', NULL ),
( 'FORCE', 'Reserved', NULL ),
( 'FOREIGN', 'Reserved', NULL ),
( 'FORMAT', 'Keyword', 'added in 5.6.5' ),
( 'FOUND', 'Keyword', NULL ),
( 'FRAC_SECOND', 'Keyword', 'removed in 5.5.3' ),
( 'FROM', 'Reserved', NULL ),
( 'FULL', 'Keyword', NULL ),
( 'FULLTEXT', 'Reserved', NULL ),
( 'FUNCTION', 'Keyword', NULL ),
( 'GENERAL', 'Keyword', 'added in 5.5.3; became nonreserved in 5.5.8' ),
( 'GENERATED', 'Reserved', 'added in 5.7' ),
( 'GEOMCOLLECTION', 'Keyword', NULL ),
( 'GEOMETRY', 'Keyword', NULL ),
( 'GEOMETRYCOLLECTION', 'Keyword', NULL ),
( 'GET', 'Reserved', 'added in 5.6.4' ),
( 'GET_FORMAT', 'Keyword', NULL ),
( 'GET_MASTER_PUBLIC_KEY', 'Keyword', 'added in 8.0' ),
( 'GLOBAL', 'Keyword', NULL ),
( 'GRANT', 'Reserved', NULL ),
( 'GRANTS', 'Keyword', NULL ),
( 'GROUP', 'Reserved', NULL ),
( 'GROUPING', 'Reserved', 'added in 8.0' ),
( 'GROUPS', 'Reserved', 'added in 8.0' ),
( 'GROUP_REPLICATION', 'Keyword', 'added in 5.7' ),
( 'HANDLER', 'Keyword', NULL ),
( 'HASH', 'Keyword', NULL ),
( 'HAVING', 'Reserved', NULL ),
( 'HELP', 'Keyword', NULL ),
( 'HIGH_PRIORITY', 'Reserved', NULL ),
( 'HISTOGRAM', 'Keyword', 'added in 8.0' ),
( 'HISTORY', 'Keyword', 'added in 8.0' ),
( 'HOST', 'Keyword', NULL ),
( 'HOSTS', 'Keyword', NULL ),
( 'HOUR', 'Keyword', NULL ),
( 'HOUR_MICROSECOND', 'Reserved', NULL ),
( 'HOUR_MINUTE', 'Reserved', NULL ),
( 'HOUR_SECOND', 'Reserved', NULL ),
( 'IDENTIFIED', 'Keyword', NULL ),
( 'IF', 'Reserved', NULL ),
( 'IGNORE', 'Reserved', NULL ),
( 'IGNORE_SERVER_IDS', 'Keyword', 'became nonreserved in 5.5.8' ),
( 'IMPORT', 'Keyword', NULL ),
( 'IN', 'Reserved', NULL ),
( 'INDEX', 'Reserved', NULL ),
( 'INDEXES', 'Keyword', NULL ),
( 'INFILE', 'Reserved', NULL ),
( 'INITIAL_SIZE', 'Keyword', NULL ),
( 'INNER', 'Reserved', NULL ),
( 'INNOBASE', 'Keyword', 'removed in 5.5.3' ),
( 'INNODB', 'Keyword', 'removed in 5.5.3' ),
( 'INOUT', 'Reserved', NULL ),
( 'INSENSITIVE', 'Reserved', NULL ),
( 'INSERT', 'Reserved', NULL ),
( 'INSERT_METHOD', 'Keyword', NULL ),
( 'INSTALL', 'Keyword', NULL ),
( 'INSTANCE', 'Keyword', 'added in 5.7' ),
( 'INT', 'Reserved', NULL ),
( 'INT1', 'Reserved', NULL ),
( 'INT2', 'Reserved', NULL ),
( 'INT3', 'Reserved', NULL ),
( 'INT4', 'Reserved', NULL ),
( 'INT8', 'Reserved', NULL ),
( 'INTEGER', 'Reserved', NULL ),
( 'INTERVAL', 'Reserved', NULL ),
( 'INTO', 'Reserved', NULL ),
( 'INVISIBLE', 'Keyword', 'added in 8.0' ),
( 'INVOKER', 'Keyword', NULL ),
( 'IO', 'Keyword', NULL ),
( 'IO_AFTER_GTIDS', 'Reserved', 'added in 5.6.5' ),
( 'IO_BEFORE_GTIDS', 'Reserved', 'added in 5.6.5' ),
( 'IO_THREAD', 'Keyword', NULL ),
( 'IPC', 'Keyword', NULL ),
( 'IS', 'Reserved', NULL ),
( 'ISOLATION', 'Keyword', NULL ),
( 'ISSUER', 'Keyword', NULL ),
( 'ITERATE', 'Reserved', NULL ),
( 'JOIN', 'Reserved', NULL ),
( 'JSON', 'Keyword', 'added in 5.7' ),
( 'JSON_TABLE', 'Reserved', 'added in 8.0' ),
( 'KEY', 'Reserved', NULL ),
( 'KEYS', 'Reserved', NULL ),
( 'KEY_BLOCK_SIZE', 'Keyword', NULL ),
( 'KILL', 'Reserved', NULL ),
( 'LAG', 'Reserved', 'added in 8.0' ),
( 'LANGUAGE', 'Keyword', NULL ),
( 'LAST', 'Keyword', NULL ),
( 'LAST_VALUE', 'Reserved', 'added in 8.0' ),
( 'LEAD', 'Reserved', 'added in 8.0' ),
( 'LEADING', 'Reserved', NULL ),
( 'LEAVE', 'Reserved', NULL ),
( 'LEAVES', 'Keyword', NULL ),
( 'LEFT', 'Reserved', NULL ),
( 'LESS', 'Keyword', NULL ),
( 'LEVEL', 'Keyword', NULL ),
( 'LIKE', 'Reserved', NULL ),
( 'LIMIT', 'Reserved', NULL ),
( 'LINEAR', 'Reserved', NULL ),
( 'LINES', 'Reserved', NULL ),
( 'LINESTRING', 'Keyword', NULL ),
( 'LIST', 'Keyword', NULL ),
( 'LOAD', 'Reserved', NULL ),
( 'LOCAL', 'Keyword', NULL ),
( 'LOCALTIME', 'Reserved', NULL ),
( 'LOCALTIMESTAMP', 'Reserved', NULL ),
( 'LOCK', 'Reserved', NULL ),
( 'LOCKED', 'Keyword', 'added in 8.0' ),
( 'LOCKS', 'Keyword', NULL ),
( 'LOGFILE', 'Keyword', NULL ),
( 'LOGS', 'Keyword', NULL ),
( 'LONG', 'Reserved', NULL ),
( 'LONGBLOB', 'Reserved', NULL ),
( 'LONGTEXT', 'Reserved', NULL ),
( 'LOOP', 'Reserved', NULL ),
( 'LOW_PRIORITY', 'Reserved', NULL ),
( 'MASTER', 'Keyword', NULL ),
( 'MASTER_AUTO_POSITION', 'Keyword', 'added in 5.6.5' ),
( 'MASTER_BIND', 'Reserved', 'added in 5.6.1' ),
( 'MASTER_CONNECT_RETRY', 'Keyword', NULL ),
( 'MASTER_DELAY', 'Keyword', NULL ),
( 'MASTER_HEARTBEAT_PERIOD', 'Keyword', 'became nonreserved in 5.5.8' ),
( 'MASTER_HOST', 'Keyword', NULL ),
( 'MASTER_LOG_FILE', 'Keyword', NULL ),
( 'MASTER_LOG_POS', 'Keyword', NULL ),
( 'MASTER_PASSWORD', 'Keyword', NULL ),
( 'MASTER_PORT', 'Keyword', NULL ),
( 'MASTER_PUBLIC_KEY_PATH', 'Keyword', 'added in 8.0' ),
( 'MASTER_RETRY_COUNT', 'Keyword', 'added in 5.6.1' ),
( 'MASTER_SERVER_ID', 'Keyword', NULL ),
( 'MASTER_SSL', 'Keyword', NULL ),
( 'MASTER_SSL_CA', 'Keyword', NULL ),
( 'MASTER_SSL_CAPATH', 'Keyword', NULL ),
( 'MASTER_SSL_CERT', 'Keyword', NULL ),
( 'MASTER_SSL_CIPHER', 'Keyword', NULL ),
( 'MASTER_SSL_CRL', 'Keyword', 'added in 5.6.3' ),
( 'MASTER_SSL_CRLPATH', 'Keyword', 'added in 5.6.3' ),
( 'MASTER_SSL_KEY', 'Keyword', NULL ),
( 'MASTER_SSL_VERIFY_SERVER_CERT', 'Reserved', NULL ),
( 'MASTER_TLS_VERSION', 'Keyword', 'added in 5.7' ),
( 'MASTER_USER', 'Keyword', NULL ),
( 'MATCH', 'Reserved', NULL ),
( 'MAXVALUE', 'Reserved', NULL ),
( 'MAX_CONNECTIONS_PER_HOUR', 'Keyword', NULL ),
( 'MAX_QUERIES_PER_HOUR', 'Keyword', NULL ),
( 'MAX_ROWS', 'Keyword', NULL ),
( 'MAX_SIZE', 'Keyword', NULL ),
( 'MAX_UPDATES_PER_HOUR', 'Keyword', NULL ),
( 'MAX_USER_CONNECTIONS', 'Keyword', NULL ),
( 'MEDIUM', 'Keyword', NULL ),
( 'MEDIUMBLOB', 'Reserved', NULL ),
( 'MEDIUMINT', 'Reserved', NULL ),
( 'MEDIUMTEXT', 'Reserved', NULL ),
( 'MEMORY', 'Keyword', NULL ),
( 'MERGE', 'Keyword', NULL ),
( 'MESSAGE_TEXT', 'Keyword', NULL ),
( 'MICROSECOND', 'Keyword', NULL ),
( 'MIDDLEINT', 'Reserved', NULL ),
( 'MIGRATE', 'Keyword', NULL ),
( 'MINUTE', 'Keyword', NULL ),
( 'MINUTE_MICROSECOND', 'Reserved', NULL ),
( 'MINUTE_SECOND', 'Reserved', NULL ),
( 'MIN_ROWS', 'Keyword', NULL ),
( 'MOD', 'Reserved', NULL ),
( 'MODE', 'Keyword', NULL ),
( 'MODIFIES', 'Reserved', NULL ),
( 'MODIFY', 'Keyword', NULL ),
( 'MONTH', 'Keyword', NULL ),
( 'MULTILINESTRING', 'Keyword', NULL ),
( 'MULTIPOINT', 'Keyword', NULL ),
( 'MULTIPOLYGON', 'Keyword', NULL ),
( 'MUTEX', 'Keyword', NULL ),
( 'MYSQL_ERRNO', 'Keyword', NULL ),
( 'NAME', 'Keyword', NULL ),
( 'NAMES', 'Keyword', NULL ),
( 'NATIONAL', 'Keyword', NULL ),
( 'NATURAL', 'Reserved', NULL ),
( 'NCHAR', 'Keyword', NULL ),
( 'NDB', 'Keyword', NULL ),
( 'NDBCLUSTER', 'Keyword', NULL ),
( 'NESTED', 'Keyword', 'added in 8.0' ),
( 'NEVER', 'Keyword', 'added in 5.7' ),
( 'NEW', 'Keyword', NULL ),
( 'NEXT', 'Keyword', NULL ),
( 'NO', 'Keyword', NULL ),
( 'NODEGROUP', 'Keyword', NULL ),
( 'NONE', 'Keyword', NULL ),
( 'NOT', 'Reserved', NULL ),
( 'NOWAIT', 'Keyword', 'added in 8.0' ),
( 'NO_WAIT', 'Keyword', NULL ),
( 'NO_WRITE_TO_BINLOG', 'Reserved', NULL ),
( 'NTH_VALUE', 'Reserved', 'added in 8.0' ),
( 'NTILE', 'Reserved', 'added in 8.0' ),
( 'NULL', 'Reserved', NULL ),
( 'NULLS', 'Keyword', 'added in 8.0' ),
( 'NUMBER', 'Keyword', 'added in 5.6.4' ),
( 'NUMERIC', 'Reserved', NULL ),
( 'NVARCHAR', 'Keyword', NULL ),
( 'OF', 'Reserved', 'added in 8.0' ),
( 'OFFSET', 'Keyword', NULL ),
( 'OLD_PASSWORD', 'Keyword', 'removed in 5.7' ),
( 'ON', 'Reserved', NULL ),
( 'ONE', 'Keyword', NULL ),
( 'ONE_SHOT', 'Keyword', 'became reserved in 5.6.1; removed in 5.6.5' ),
( 'ONLY', 'Keyword', 'added in 5.6.5' ),
( 'OPEN', 'Keyword', NULL ),
( 'OPTIMIZE', 'Reserved', NULL ),
( 'OPTIMIZER_COSTS', 'Reserved', 'added in 5.7' ),
( 'OPTION', 'Reserved', NULL ),
( 'OPTIONALLY', 'Reserved', NULL ),
( 'OPTIONS', 'Keyword', NULL ),
( 'OR', 'Reserved', NULL ),
( 'ORDER', 'Reserved', NULL ),
( 'ORDINALITY', 'Keyword', 'added in 8.0' ),
( 'OTHERS', 'Keyword', 'added in 8.0' ),
( 'OUT', 'Reserved', NULL ),
( 'OUTER', 'Reserved', NULL ),
( 'OUTFILE', 'Reserved', NULL ),
( 'OVER', 'Reserved', 'added in 8.0' ),
( 'OWNER', 'Keyword', NULL ),
( 'PACK_KEYS', 'Keyword', NULL ),
( 'PAGE', 'Keyword', NULL ),
( 'PARSER', 'Keyword', NULL ),
( 'PARSE_GCOL_EXPR', 'Keyword', 'added in 5.7; removed in 8.0' ),
( 'PARTIAL', 'Keyword', NULL ),
( 'PARTITION', 'Reserved', 'became reserved in 5.6.2' ),
( 'PARTITIONING', 'Keyword', NULL ),
( 'PARTITIONS', 'Keyword', NULL ),
( 'PASSWORD', 'Keyword', NULL ),
( 'PATH', 'Keyword', 'added in 8.0' ),
( 'PERCENT_RANK', 'Reserved', 'added in 8.0' ),
( 'PERSIST', 'Reserved', 'added in 8.0' ),
( 'PERSIST_ONLY', 'Reserved', 'added in 8.0' ),
( 'PHASE', 'Keyword', NULL ),
( 'PLUGIN', 'Keyword', NULL ),
( 'PLUGINS', 'Keyword', NULL ),
( 'PLUGIN_DIR', 'Keyword', 'added in 5.6.4' ),
( 'POINT', 'Keyword', NULL ),
( 'POLYGON', 'Keyword', NULL ),
( 'PORT', 'Keyword', NULL ),
( 'PRECEDES', 'Keyword', 'added in 5.7' ),
( 'PRECEDING', 'Keyword', 'added in 8.0' ),
( 'PRECISION', 'Reserved', NULL ),
( 'PREPARE', 'Keyword', NULL ),
( 'PRESERVE', 'Keyword', NULL ),
( 'PREV', 'Keyword', NULL ),
( 'PRIMARY', 'Reserved', NULL ),
( 'PRIVILEGES', 'Keyword', NULL ),
( 'PROCEDURE', 'Reserved', NULL ),
( 'PROCESS', 'Keyword', 'added in 8.0' ),
( 'PROCESSLIST', 'Keyword', NULL ),
( 'PROFILE', 'Keyword', NULL ),
( 'PROFILES', 'Keyword', NULL ),
( 'PROXY', 'Keyword', 'added in 5.5.7' ),
( 'PURGE', 'Reserved', NULL ),
( 'QUARTER', 'Keyword', NULL ),
( 'QUERY', 'Keyword', NULL ),
( 'QUICK', 'Keyword', NULL ),
( 'RANGE', 'Reserved', NULL ),
( 'RANK', 'Reserved', 'added in 8.0' ),
( 'READ', 'Reserved', NULL ),
( 'READS', 'Reserved', NULL ),
( 'READ_ONLY', 'Keyword', NULL ),
( 'READ_WRITE', 'Reserved', NULL ),
( 'REAL', 'Reserved', NULL ),
( 'REBUILD', 'Keyword', NULL ),
( 'RECOVER', 'Keyword', NULL ),
( 'RECURSIVE', 'Reserved', 'added in 8.0' ),
( 'REDOFILE', 'Keyword', 'removed in 8.0' ),
( 'REDO_BUFFER_SIZE', 'Keyword', NULL ),
( 'REDUNDANT', 'Keyword', NULL ),
( 'REFERENCE', 'Keyword', 'added in 8.0' ),
( 'REFERENCES', 'Reserved', NULL ),
( 'REGEXP', 'Reserved', NULL ),
( 'RELAY', 'Keyword', 'added in 5.5.3' ),
( 'RELAYLOG', 'Keyword', NULL ),
( 'RELAY_LOG_FILE', 'Keyword', NULL ),
( 'RELAY_LOG_POS', 'Keyword', NULL ),
( 'RELAY_THREAD', 'Keyword', NULL ),
( 'RELEASE', 'Reserved', NULL ),
( 'RELOAD', 'Keyword', NULL ),
( 'REMOTE', 'Keyword', 'added in 8.0' ),
( 'REMOVE', 'Keyword', NULL ),
( 'RENAME', 'Reserved', NULL ),
( 'REORGANIZE', 'Keyword', NULL ),
( 'REPAIR', 'Keyword', NULL ),
( 'REPEAT', 'Reserved', NULL ),
( 'REPEATABLE', 'Keyword', NULL ),
( 'REPLACE', 'Reserved', NULL ),
( 'REPLICATE_DO_DB', 'Keyword', 'added in 5.7' ),
( 'REPLICATE_DO_TABLE', 'Keyword', 'added in 5.7' ),
( 'REPLICATE_IGNORE_DB', 'Keyword', 'added in 5.7' ),
( 'REPLICATE_IGNORE_TABLE', 'Keyword', 'added in 5.7' ),
( 'REPLICATE_REWRITE_DB', 'Keyword', 'added in 5.7' ),
( 'REPLICATE_WILD_DO_TABLE', 'Keyword', 'added in 5.7' ),
( 'REPLICATE_WILD_IGNORE_TABLE', 'Keyword', 'added in 5.7' ),
( 'REPLICATION', 'Keyword', NULL ),
( 'REQUIRE', 'Reserved', NULL ),
( 'RESET', 'Keyword', NULL ),
( 'RESIGNAL', 'Reserved', NULL ),
( 'RESOURCE', 'Keyword', 'added in 8.0' ),
( 'RESPECT', 'Keyword', 'added in 8.0' ),
( 'RESTART', 'Keyword', 'added in 8.0' ),
( 'RESTORE', 'Keyword', NULL ),
( 'RESTRICT', 'Reserved', NULL ),
( 'RESUME', 'Keyword', NULL ),
( 'RETURN', 'Reserved', NULL ),
( 'RETURNED_SQLSTATE', 'Keyword', 'added in 5.6.4' ),
( 'RETURNS', 'Keyword', NULL ),
( 'REUSE', 'Keyword', 'added in 8.0' ),
( 'REVERSE', 'Keyword', NULL ),
( 'REVOKE', 'Reserved', NULL ),
( 'RIGHT', 'Reserved', NULL ),
( 'RLIKE', 'Reserved', NULL ),
( 'ROLE', 'Keyword', 'added in 8.0' ),
( 'ROLLBACK', 'Keyword', NULL ),
( 'ROLLUP', 'Keyword', NULL ),
( 'ROTATE', 'Keyword', 'added in 5.7' ),
( 'ROUTINE', 'Keyword', NULL ),
( 'ROW', 'Keyword', NULL ),
( 'ROWS', 'Keyword', NULL ),
( 'ROW_COUNT', 'Keyword', 'added in 5.6.4' ),
( 'ROW_FORMAT', 'Keyword', NULL ),
( 'ROW_NUMBER', 'Reserved', 'added in 8.0' ),
( 'RTREE', 'Keyword', NULL ),
( 'SAVEPOINT', 'Keyword', NULL ),
( 'SCHEDULE', 'Keyword', NULL ),
( 'SCHEMA', 'Reserved', NULL ),
( 'SCHEMAS', 'Reserved', NULL ),
( 'SCHEMA_NAME', 'Keyword', NULL ),
( 'SECOND', 'Keyword', NULL ),
( 'SECOND_MICROSECOND', 'Reserved', NULL ),
( 'SECURITY', 'Keyword', NULL ),
( 'SELECT', 'Reserved', NULL ),
( 'SENSITIVE', 'Reserved', NULL ),
( 'SEPARATOR', 'Reserved', NULL ),
( 'SERIAL', 'Keyword', NULL ),
( 'SERIALIZABLE', 'Keyword', NULL ),
( 'SERVER', 'Keyword', NULL ),
( 'SESSION', 'Keyword', NULL ),
( 'SET', 'Reserved', NULL ),
( 'SHARE', 'Keyword', NULL ),
( 'SHOW', 'Reserved', NULL ),
( 'SHUTDOWN', 'Keyword', NULL ),
( 'SIGNAL', 'Reserved', NULL ),
( 'SIGNED', 'Keyword', NULL ),
( 'SIMPLE', 'Keyword', NULL ),
( 'SKIP', 'Keyword', 'added in 8.0' ),
( 'SLAVE', 'Keyword', NULL ),
( 'SLOW', 'Keyword', 'added in 5.5.3; became nonreserved in 5.5.8' ),
( 'SMALLINT', 'Reserved', NULL ),
( 'SNAPSHOT', 'Keyword', NULL ),
( 'SOCKET', 'Keyword', NULL ),
( 'SOME', 'Keyword', NULL ),
( 'SONAME', 'Keyword', NULL ),
( 'SOUNDS', 'Keyword', NULL ),
( 'SOURCE', 'Keyword', NULL ),
( 'SPATIAL', 'Reserved', NULL ),
( 'SPECIFIC', 'Reserved', NULL ),
( 'SQL', 'Reserved', NULL ),
( 'SQLEXCEPTION', 'Reserved', NULL ),
( 'SQLSTATE', 'Reserved', NULL ),
( 'SQLWARNING', 'Reserved', NULL ),
( 'SQL_AFTER_GTIDS', 'Keyword', 'added in 5.6.5; became nonreserved in 5.6.6' ),
( 'SQL_AFTER_MTS_GAPS', 'Keyword', 'added in 5.6.6' ),
( 'SQL_BEFORE_GTIDS', 'Keyword', 'added in 5.6.5; became nonreserved in 5.6.6' ),
( 'SQL_BIG_RESULT', 'Reserved', NULL ),
( 'SQL_BUFFER_RESULT', 'Keyword', NULL ),
( 'SQL_CACHE', 'Keyword', 'removed in 8.0' ),
( 'SQL_CALC_FOUND_ROWS', 'Reserved', NULL ),
( 'SQL_NO_CACHE', 'Keyword', NULL ),
( 'SQL_SMALL_RESULT', 'Reserved', NULL ),
( 'SQL_THREAD', 'Keyword', NULL ),
( 'SQL_TSI_DAY', 'Keyword', NULL ),
( 'SQL_TSI_FRAC_SECOND', 'Keyword', 'removed in 5.5.3' ),
( 'SQL_TSI_HOUR', 'Keyword', NULL ),
( 'SQL_TSI_MINUTE', 'Keyword', NULL ),
( 'SQL_TSI_MONTH', 'Keyword', NULL ),
( 'SQL_TSI_QUARTER', 'Keyword', NULL ),
( 'SQL_TSI_SECOND', 'Keyword', NULL ),
( 'SQL_TSI_WEEK', 'Keyword', NULL ),
( 'SQL_TSI_YEAR', 'Keyword', NULL ),
( 'SRID', 'Keyword', 'added in 8.0' ),
( 'SSL', 'Reserved', NULL ),
( 'STACKED', 'Keyword', 'added in 5.7' ),
( 'START', 'Keyword', NULL ),
( 'STARTING', 'Reserved', NULL ),
( 'STARTS', 'Keyword', NULL ),
( 'STATS_AUTO_RECALC', 'Keyword', 'added in 5.6.6' ),
( 'STATS_PERSISTENT', 'Keyword', 'added in 5.6.6' ),
( 'STATS_SAMPLE_PAGES', 'Keyword', 'added in 5.6.6' ),
( 'STATUS', 'Keyword', NULL ),
( 'STOP', 'Keyword', NULL ),
( 'STORAGE', 'Keyword', NULL ),
( 'STORED', 'Reserved', 'added in 5.7' ),
( 'STRAIGHT_JOIN', 'Reserved', NULL ),
( 'STRING', 'Keyword', NULL ),
( 'SUBCLASS_ORIGIN', 'Keyword', NULL ),
( 'SUBJECT', 'Keyword', NULL ),
( 'SUBPARTITION', 'Keyword', NULL ),
( 'SUBPARTITIONS', 'Keyword', NULL ),
( 'SUPER', 'Keyword', NULL ),
( 'SUSPEND', 'Keyword', NULL ),
( 'SWAPS', 'Keyword', NULL ),
( 'SWITCHES', 'Keyword', NULL ),
( 'SYSTEM', 'Reserved', 'added in 8.0' ),
( 'TABLE', 'Reserved', NULL ),
( 'TABLES', 'Keyword', NULL ),
( 'TABLESPACE', 'Keyword', NULL ),
( 'TABLE_CHECKSUM', 'Keyword', NULL ),
( 'TABLE_NAME', 'Keyword', NULL ),
( 'TEMPORARY', 'Keyword', NULL ),
( 'TEMPTABLE', 'Keyword', NULL ),
( 'TERMINATED', 'Reserved', NULL ),
( 'TEXT', 'Keyword', NULL ),
( 'THAN', 'Keyword', NULL ),
( 'THEN', 'Reserved', NULL ),
( 'THREAD_PRIORITY', 'Keyword', 'added in 8.0' ),
( 'TIES', 'Keyword', 'added in 8.0' ),
( 'TIME', 'Keyword', NULL ),
( 'TIMESTAMP', 'Keyword', NULL ),
( 'TIMESTAMPADD', 'Keyword', NULL ),
( 'TIMESTAMPDIFF', 'Keyword', NULL ),
( 'TINYBLOB', 'Reserved', NULL ),
( 'TINYINT', 'Reserved', NULL ),
( 'TINYTEXT', 'Reserved', NULL ),
( 'TO', 'Reserved', NULL ),
( 'TRAILING', 'Reserved', NULL ),
( 'TRANSACTION', 'Keyword', NULL ),
( 'TRIGGER', 'Reserved', NULL ),
( 'TRIGGERS', 'Keyword', NULL ),
( 'TRUE', 'Reserved', NULL ),
( 'TRUNCATE', 'Keyword', NULL ),
( 'TYPE', 'Keyword', NULL ),
( 'TYPES', 'Keyword', NULL ),
( 'UNBOUNDED', 'Keyword', 'added in 8.0' ),
( 'UNCOMMITTED', 'Keyword', NULL ),
( 'UNDEFINED', 'Keyword', NULL ),
( 'UNDO', 'Reserved', NULL ),
( 'UNDOFILE', 'Keyword', NULL ),
( 'UNDO_BUFFER_SIZE', 'Keyword', NULL ),
( 'UNICODE', 'Keyword', NULL ),
( 'UNINSTALL', 'Keyword', NULL ),
( 'UNION', 'Reserved', NULL ),
( 'UNIQUE', 'Reserved', NULL ),
( 'UNKNOWN', 'Keyword', NULL ),
( 'UNLOCK', 'Reserved', NULL ),
( 'UNSIGNED', 'Reserved', NULL ),
( 'UNTIL', 'Keyword', NULL ),
( 'UPDATE', 'Reserved', NULL ),
( 'UPGRADE', 'Keyword', NULL ),
( 'USAGE', 'Reserved', NULL ),
( 'USE', 'Reserved', NULL ),
( 'USER', 'Keyword', NULL ),
( 'USER_RESOURCES', 'Keyword', NULL ),
( 'USE_FRM', 'Keyword', NULL ),
( 'USING', 'Reserved', NULL ),
( 'UTC_DATE', 'Reserved', NULL ),
( 'UTC_TIME', 'Reserved', NULL ),
( 'VALIDATION', 'Keyword', 'added in 5.7' ),
( 'VALUES', 'Reserved', NULL ),
( 'VARBINARY', 'Reserved', NULL ),
( 'VARCHAR', 'Reserved', NULL ),
( 'VARCHARACTER', 'Reserved', NULL ),
( 'VARIABLES', 'Keyword', NULL ),
( 'VARYING', 'Reserved', NULL ),
( 'VCPU', 'Keyword', 'added in 8.0' ),
( 'VIEW', 'Keyword', NULL ),
( 'VIRTUAL', 'Reserved', 'added in 5.7' ),
( 'VISIBLE', 'Keyword', 'added in 8.0' ),
( 'WAIT', 'Keyword', NULL ),
( 'WARNINGS', 'Keyword', NULL ),
( 'WEEK', 'Keyword', NULL ),
( 'WEIGHT_STRING', 'Keyword', NULL ),
( 'WHEN', 'Reserved', NULL ),
( 'WHERE', 'Reserved', NULL ),
( 'WHILE', 'Reserved', NULL ),
( 'WINDOW', 'Reserved', 'added in 8.0' ),
( 'WITH', 'Reserved', NULL ),
( 'WITHOUT', 'Keyword', 'added in 5.7' ),
( 'WORK', 'Keyword', NULL ),
( 'WRAPPER', 'Keyword', NULL ),
( 'WRITE', 'Reserved', NULL ),
( 'X509', 'Keyword', NULL ),
( 'XA', 'Keyword', NULL ),
( 'XID', 'Keyword', 'added in 5.7' ),
( 'XML', 'Keyword', NULL ),
( 'XOR', 'Reserved', NULL ),
( 'YEAR', 'Keyword', NULL ),
( 'YEAR_MONTH', 'Reserved', NULL ),
( 'ZEROFILL', 'Reserved', NULL );
SELECT ROW_COUNT();
SHOW WARNINGS;




-- ---------- ---------- ----------
ANALYZE TABLE reserved_words;
SHOW TABLE STATUS FROM DBA
LIKE 'reserved_words'\G
SHOW INDEX FROM reserved_words
IN DBA;




-- ---------- ---------- ----------
-- What sort of variety do we have?
-- ---------- ---------- ----------

-- +--------------+-------+
-- | word_type | count |
-- +--------------+-------+
-- | Keyword | 427 |
-- | Reserved | 258 |
-- | TOTAL --> | 685 |
-- +--------------+-------+

SELECT
CASE
WHEN A.reserved_type IS NULL THEN ' TOTAL -->'
ELSE A.reserved_type
END AS word_type,
FORMAT( A.c, 0 ) AS 'count'
FROM
(
SELECT
reserved_type,
COUNT(*) AS c
FROM
reserved_words
GROUP BY
reserved_type
WITH ROLLUP
) A;


-- +---------------------------------------------+-------+
-- | note | Count |
-- +---------------------------------------------+-------+
-- | added in 5.5.3 | 2 |
-- | added in 5.5.3; became nonreserved in 5.5.8 | 2 |
-- | added in 5.5.7 | 1 |
-- | added in 5.6.1 | 2 |
-- | added in 5.6.3 | 2 |
-- | added in 5.6.4 | 8 |
-- | added in 5.6.5 | 5 |
-- | added in 5.6.5; became nonreserved in 5.6.6 | 2 |
-- | added in 5.6.6 | 7 |
-- | added in 5.6.6; removed in 8.0 | 1 |
-- | added in 5.7 | 30 |
-- | added in 5.7; removed in 8.0 | 1 |
-- | added in 8.0 | 59 |
-- | became nonreserved in 5.5.8 | 2 |
-- | became reserved in 5.6.1; removed in 5.6.5 | 1 |
-- | became reserved in 5.6.2 | 1 |
-- | removed in 5.5.3 | 4 |
-- | removed in 5.6.8 | 2 |
-- | removed in 5.7 | 1 |
-- | removed in 8.0 | 3 |
-- | NULL | 549 |
-- +---------------------------------------------+-------+
-- 21 rows in set (0.01 sec)

SELECT
note,
FORMAT( COUNT(*), 0 ) AS 'Count'
FROM
reserved_words
GROUP BY
note
ORDER BY
COALESCE( note, '���' ) ASC; /* NULLS LAST by using 3 very large UTF8 characters (U+FFFFD) */

Options: ReplyQuote


Subject
Views
Written By
Posted
reserved words/keywords list
4317
March 15, 2018 11:09AM
191
March 15, 2018 03:27PM
173
March 15, 2018 03:51PM
180
March 15, 2018 04:25PM
188
March 15, 2018 11:00PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.