KEYWORDS 表列出了 MySQL 认为是关键字的单词,并且为每个单词指明它是否被保留。保留关键字在某些情况下可能需要特殊处理,例如在用作标识符时需要特殊引用(参见 第 11.3 节,“关键字和保留字”)。此表为应用程序提供了 MySQL 关键字信息的运行时来源。The KEYWORDS table lists the words
considered keywords by MySQL and, for each one, indicates whether
it is reserved. Reserved keywords may require special treatment in
some contexts, such as special quoting when used as identifiers
(see Section 11.3, “Keywords and Reserved Words”). This table provides applications
a runtime source of MySQL keyword information.
KEYWORDS 表具有以下列:The KEYWORDS table has these columns:
WORD关键字。The keyword.
RESERVED一个整数,用于指示关键字是保留的(1)还是非保留的(0)。An integer indicating whether the keyword is reserved (1) or nonreserved (0).
这些查询分别列出所有关键字、所有保留关键字和所有非保留关键字:These queries lists all keywords, all reserved keywords, and all nonreserved keywords, respectively:
SELECT * FROM INFORMATION_SCHEMA.KEYWORDS; SELECT WORD FROM INFORMATION_SCHEMA.KEYWORDS WHERE RESERVED = 1; SELECT WORD FROM INFORMATION_SCHEMA.KEYWORDS WHERE RESERVED = 0;
后两个查询等同于:The latter two queries are equivalent to:
SELECT WORD FROM INFORMATION_SCHEMA.KEYWORDS WHERE RESERVED; SELECT WORD FROM INFORMATION_SCHEMA.KEYWORDS WHERE NOT RESERVED;
如果你从源代码构建 MySQL,构建过程会生成一个 keyword_list.h 头文件,其中包含关键字数组及其保留状态。该文件可以在构建目录下的 sql 目录中找到。对于需要关键字列表静态来源的应用程序,该文件可能会很有用。If you build MySQL from source, the build process generates a
keyword_list.h header file containing an
array of keywords and their reserved status. This file can be
found in the sql directory under the build
directory. This file may be useful for applications that require a
static source for the keyword list.