#!/usr/bin/env bash
if ! $MYSQL_CMD -e 'select 1' > /dev/null; then
echo 'Failed to run query.'
exit 1;
fi
$MYSQL_CMD --skip-column-names -e 'select name from mysql.help_keyword' | grep -v '[^A-Z_0-9]' | while read -r k; do
$MYSQL_CMD -e "select 1 as $k" > /dev/null 2>&1 || echo "$k"
done
ADD
ALL
ALTER
ANALYZE
AND
AS
ASC
BEFORE
BETWEEN
BINARY
BOTH
BY
CALL
CASCADE
CASE
CHANGE
CHAR
CHARACTER
CHECK
COLLATE
COLUMN
CONDITION
CONSTRAINT
CONTINUE
CONVERT
CREATE
CROSS
CURRENT_DATE
CURRENT_TIME
CURRENT_TIMESTAMP
CURRENT_USER
CURSOR
DATABASE
DATABASES
DAY_HOUR
DAY_MINUTE
DAY_SECOND
DEC
DECIMAL
DECLARE
DEFAULT
DELAYED
DELETE
DESC
DESCRIBE
DISTINCT
DISTINCTROW
DIV
DROP
DUAL
ELSE
ELSEIF
ENCLOSED
ESCAPED
EXISTS
EXIT
EXPLAIN
FALSE
FETCH
FLOAT4
FLOAT8
FOR
FORCE
FOREIGN
FROM
FULLTEXT
GET
GRANT
GROUP
HAVING
HIGH_PRIORITY
HOUR_MINUTE
HOUR_SECOND
IF
IGNORE
IN
INDEX
INFILE
INNER
INSERT
INT1
INT2
INT3
INT4
INT8
INTEGER
INTERVAL
INTO
IS
ITERATE
JOIN
KEY
KEYS
KILL
LEADING
LEAVE
LEFT
LIKE
LIMIT
LINES
LOAD
LOCALTIME
LOCALTIMESTAMP
LOCK
LONG
LOOP
LOW_PRIORITY
MASTER_BIND
MASTER_SSL_VERIFY_SERVER_CERT
MATCH
MIDDLEINT
MINUTE_SECOND
MOD
NATURAL
NOT
NO_WRITE_TO_BINLOG
NULL
NUMERIC
ON
OPTIMIZE
OPTIMIZER_COSTS
OPTION
OPTIONALLY
OR
ORDER
OUTER
OUTFILE
PARTITION
PRECISION
PRIMARY
PROCEDURE
PURGE
READ
REAL
REFERENCES
REGEXP
RELEASE
RENAME
REPEAT
REPLACE
REQUIRE
RESIGNAL
RESTRICT
RETURN
REVOKE
RIGHT
RLIKE
SCHEMA
SCHEMAS
SELECT
SEPARATOR
SET
SHOW
SIGNAL
SPATIAL
SQLSTATE
SQL_BIG_RESULT
SQL_CALC_FOUND_ROWS
SQL_SMALL_RESULT
SSL
STARTING
STORED
STRAIGHT_JOIN
TABLE
TERMINATED
THEN
TO
TRAILING
TRIGGER
TRUE
UNDO
UNION
UNIQUE
UNLOCK
UNSIGNED
UPDATE
USAGE
USE
USING
UTC_DATE
UTC_TIME
UTC_TIMESTAMP
VALUES
VARCHARACTER
VARYING
VIRTUAL
WHEN
WHERE
WHILE
WITH
WRITE
XOR
YEAR_MONTH
ZEROFILL
而对于MySQL 8.0.24:
ADD
ALL
ALTER
ANALYZE
AND
AS
ASC
BEFORE
BETWEEN
BINARY
BOTH
BY
CALL
CASCADE
CASE
CHANGE
CHAR
CHARACTER
CHECK
COLLATE
COLUMN
CONDITION
CONSTRAINT
CONTINUE
CONVERT
CREATE
CROSS
CUME_DIST
CURRENT_DATE
CURRENT_TIME
CURRENT_TIMESTAMP
CURRENT_USER
CURSOR
DATABASE
DATABASES
DAY_HOUR
DAY_MINUTE
DAY_SECOND
DEC
DECIMAL
DECLARE
DEFAULT
DELAYED
DELETE
DENSE_RANK
DESC
DESCRIBE
DISTINCT
DISTINCTROW
DIV
DROP
DUAL
ELSE
ELSEIF
ENCLOSED
ESCAPED
EXCEPT
EXISTS
EXIT
EXPLAIN
FALSE
FETCH
FIRST_VALUE
FLOAT4
FLOAT8
FOR
FORCE
FOREIGN
FROM
FULLTEXT
FUNCTION
GET
GRANT
GROUP
GROUPING
HAVING
HIGH_PRIORITY
HOUR_MINUTE
HOUR_SECOND
IF
IGNORE
IN
INDEX
INFILE
INNER
INSERT
INT1
INT2
INT3
INT4
INT8
INTEGER
INTERVAL
INTO
IS
ITERATE
JOIN
JSON_TABLE
KEY
KEYS
KILL
LAG
LAST_VALUE
LEAD
LEADING
LEAVE
LEFT
LIKE
LIMIT
LINES
LOAD
LOCALTIME
LOCALTIMESTAMP
LOCK
LONG
LOOP
LOW_PRIORITY
MASTER_BIND
MASTER_SSL_VERIFY_SERVER_CERT
MATCH
MIDDLEINT
MINUTE_SECOND
MOD
NATURAL
NOT
NO_WRITE_TO_BINLOG
NTH_VALUE
NTILE
NULL
NUMERIC
OF
ON
OPTIMIZE
OPTIMIZER_COSTS
OPTION
OPTIONALLY
OR
ORDER
OUTER
OUTFILE
PARTITION
PERCENT_RANK
PRECISION
PRIMARY
PROCEDURE
PURGE
RANK
READ
REAL
REFERENCES
REGEXP
RELEASE
RENAME
REPEAT
REPLACE
REQUIRE
RESIGNAL
RESTRICT
RETURN
REVOKE
RIGHT
RLIKE
ROW
ROWS
ROW_NUMBER
SCHEMA
SCHEMAS
SELECT
SEPARATOR
SET
SHOW
SIGNAL
SPATIAL
SQLSTATE
SQL_BIG_RESULT
SQL_CALC_FOUND_ROWS
SQL_SMALL_RESULT
SSL
STARTING
STORED
STRAIGHT_JOIN
SYSTEM
TABLE
TERMINATED
THEN
TO
TRAILING
TRIGGER
TRUE
UNDO
UNION
UNIQUE
UNLOCK
UNSIGNED
UPDATE
USAGE
USE
USING
UTC_DATE
UTC_TIME
UTC_TIMESTAMP
VALUES
VARCHARACTER
VARYING
VIRTUAL
WHEN
WHERE
WHILE
WITH
WRITE
XOR
YEAR_MONTH
ZEROFILL
并且只有在5.7.34和8.0.24之间添加的保留字:
CUME_DIST
DENSE_RANK
EXCEPT
FIRST_VALUE
FUNCTION
GROUPING
JSON_TABLE
LAG
LAST_VALUE
LEAD
NTH_VALUE
NTILE
OF
PERCENT_RANK
RANK
ROW
ROW_NUMBER
ROWS
SYSTEM
6条答案
按热度按时间oxalkeyp1#
MySQL(5.x)中有一个mysql模式
您可以查询:
qvk1mo1f2#
这里有一个完整的列表,直到5.6...
exdqitrt3#
我不这么认为。有一个关于the documentation的评论建议创建一个包含以下单词的表:
qnzebej04#
MySQL8.0的所有保留字均从此处提取:
我发现它时,我正在为vim的mysql关键字完成。
gr8qqesn5#
我编写这个脚本是为了测试每个保留字,因为我发现这样做比理解文档中的所有特性更容易:
用法示例:
以下是MySQL 5.7.34中的保留字列表:
而对于MySQL 8.0.24:
并且只有在5.7.34和8.0.24之间添加的保留字:
np8igboo6#
显示文档https://dev.mysql.com/doc/refman/8.0/en/information-schema-keywords-table.html