8.4 中文镜像

MySQL 8.4 参考手册 · 中文镜像

正文为中文,英文原文默认隐藏。点击任意中文段落即可展开 / 收起对应英文原文。

打开官方英文原文 ↗

译文由机器翻译生成,仅供理解参考;有疑问请以官方英文原文为准。

MySQL 8.4 参考手册 / 1 一般信息 / 1.7 MySQL 标准合规性 / 1.7.1 MySQL 对标准 SQL 的扩展
中文点击中文段落可显示 / 隐藏英文原文本页译文覆盖 100%

1.7.1 MySQL 对标准 SQL 的扩展1.7.1 MySQL Extensions to Standard SQL

MySQL Server 支持某些您在其他 SQL DBMS 中不太可能找到的扩展。请注意,如果您使用它们,您的代码很可能无法移植到其他 SQL 服务器。在某些情况下,您可以通过使用以下形式的注释来编写包含 MySQL 扩展但仍然可移植的代码:MySQL Server supports some extensions that you are not likely to find in other SQL DBMSs. Be warned that if you use them, your code is most likely not portable to other SQL servers. In some cases, you can write code that includes MySQL extensions, but is still portable, by using comments of the following form:

/*! MySQL-specific code */

在这种情况下,MySQL Server 会像解析任何其他 SQL 语句一样解析并执行注释中的代码,但其他 SQL 服务器应忽略扩展。例如,MySQL 服务器可以识别以下语句中的 STRAIGHT_JOIN 关键字,但其他服务器则不能:In this case, MySQL Server parses and executes the code within the comment as it would any other SQL statement, but other SQL servers should ignore the extensions. For example, MySQL Server recognizes the STRAIGHT_JOIN keyword in the following statement, but other servers should not:

SELECT /*! STRAIGHT_JOIN */ col1 FROM table1,table2 WHERE ...

如果在!字符后添加版本号,则仅当 MySQL 版本大于或等于指定的版本号时才执行注释内的语法。以下注释中的 KEY_BLOCK_SIZE 子句仅由 MySQL 5.1.10 或更高版本的服务器执行:If you add a version number after the ! character, the syntax within the comment is executed only if the MySQL version is greater than or equal to the specified version number. The KEY_BLOCK_SIZE clause in the following comment is executed only by servers from MySQL 5.1.10 or higher:

CREATE TABLE t1(a INT, KEY (a)) /*!50110 KEY_BLOCK_SIZE=1024 */;

以下描述按类别列出了 MySQL 扩展。The following descriptions list MySQL extensions, organized by category.