From 01a850a8ad51e8f27f5eae8125c34eca29becfe3 Mon Sep 17 00:00:00 2001 From: Aolin Date: Thu, 18 Apr 2024 10:37:43 +0800 Subject: [PATCH] ebnf: show bindings, show databases, show privileges, show config (#17079) --- sql-statements/sql-statement-show-bindings.md | 29 +++++-------------- sql-statements/sql-statement-show-config.md | 19 +++++------- .../sql-statement-show-databases.md | 18 +++++------- .../sql-statement-show-privileges.md | 13 ++++----- 4 files changed, 28 insertions(+), 51 deletions(-) diff --git a/sql-statements/sql-statement-show-bindings.md b/sql-statements/sql-statement-show-bindings.md index 7cb5f12ea63d..7c736d272e22 100644 --- a/sql-statements/sql-statement-show-bindings.md +++ b/sql-statements/sql-statement-show-bindings.md @@ -10,30 +10,17 @@ aliases: ['/docs-cn/dev/sql-statements/sql-statement-show-bindings/'] ## 语法图 -**ShowStmt:** +```ebnf+diagram +ShowBindingsStmt ::= + "SHOW" ("GLOBAL" | "SESSION")? "BINDINGS" ShowLikeOrWhere? -![ShowStmt](/media/sqlgram/ShowStmt.png) - -**ShowTargetFilterable:** - -![ShowTargetFilterable](/media/sqlgram/ShowTargetFilterable.png) - -**GlobalScope:** - -![GlobalScope](/media/sqlgram/GlobalScope.png) - -**ShowLikeOrWhereOpt** - -![ShowLikeOrWhereOpt](/media/sqlgram/ShowLikeOrWhereOpt.png) +ShowLikeOrWhere ::= + "LIKE" SimpleExpr +| "WHERE" Expression +``` ## 语法说明 -{{< copyable "sql" >}} - -```sql -SHOW [GLOBAL | SESSION] BINDINGS [ShowLikeOrWhereOpt]; -``` - 该语句会输出 GLOBAL 或者 SESSION 作用域内的执行计划绑定,在不指定作用域时默认作用域为 SESSION。目前 `SHOW BINDINGS` 会输出 8 列,具体如下: | 列名 | 说明 | @@ -50,8 +37,6 @@ SHOW [GLOBAL | SESSION] BINDINGS [ShowLikeOrWhereOpt]; ## 示例 -{{< copyable "sql" >}} - ```sql CREATE TABLE t1 ( id INT NOT NULL PRIMARY KEY auto_increment, diff --git a/sql-statements/sql-statement-show-config.md b/sql-statements/sql-statement-show-config.md index ffd4c3bc34dd..75801e7c11ae 100644 --- a/sql-statements/sql-statement-show-config.md +++ b/sql-statements/sql-statement-show-config.md @@ -10,20 +10,19 @@ aliases: ['/docs-cn/dev/sql-statements/sql-statement-show-config/'] ## 语法图 -**ShowStmt:** +```ebnf+diagram +ShowConfigStmt ::= + "SHOW" "CONFIG" ShowLikeOrWhere? -![ShowStmt](/media/sqlgram/ShowStmt.png) - -**ShowTargetFilterable:** - -![ShowTargetFilterable](/media/sqlgram/ShowTargetFilterable.png) +ShowLikeOrWhere ::= + "LIKE" SimpleExpr +| "WHERE" Expression +``` ## 示例 显示所有配置: -{{< copyable "sql" >}} - ```sql SHOW CONFIG; ``` @@ -41,8 +40,6 @@ SHOW CONFIG; 显示 `type` 是 `tidb` 的配置: -{{< copyable "sql" >}} - ```sql SHOW CONFIG WHERE type = 'tidb' AND name = 'advertise-address'; ``` @@ -58,8 +55,6 @@ SHOW CONFIG WHERE type = 'tidb' AND name = 'advertise-address'; 也可以用 `LIKE` 子句来显示 `type` 是 `tidb` 的配置: -{{< copyable "sql" >}} - ```sql SHOW CONFIG LIKE 'tidb'; ``` diff --git a/sql-statements/sql-statement-show-databases.md b/sql-statements/sql-statement-show-databases.md index ad35898d513e..b4fe3489c85e 100644 --- a/sql-statements/sql-statement-show-databases.md +++ b/sql-statements/sql-statement-show-databases.md @@ -14,16 +14,17 @@ aliases: ['/docs-cn/dev/sql-statements/sql-statement-show-databases/','/docs-cn/ **ShowDatabasesStmt:** -![ShowDatabasesStmt](/media/sqlgram/ShowDatabasesStmt.png) +```ebnf+diagram +ShowDatabasesStmt ::= + "SHOW" "DATABASES" ShowLikeOrWhere? -**ShowLikeOrWhereOpt:** - -![ShowLikeOrWhereOpt](/media/sqlgram/ShowLikeOrWhereOpt.png) +ShowLikeOrWhere ::= + "LIKE" SimpleExpr +| "WHERE" Expression +``` ## 示例 -{{< copyable "sql" >}} - ```sql SHOW DATABASES; ``` @@ -40,8 +41,6 @@ SHOW DATABASES; 4 rows in set (0.00 sec) ``` -{{< copyable "sql" >}} - ```sql CREATE DATABASE mynewdb; ``` @@ -50,8 +49,6 @@ CREATE DATABASE mynewdb; Query OK, 0 rows affected (0.10 sec) ``` -{{< copyable "sql" >}} - ```sql SHOW DATABASES; ``` @@ -78,3 +75,4 @@ SHOW DATABASES; * [SHOW SCHEMAS](/sql-statements/sql-statement-show-schemas.md) * [DROP DATABASE](/sql-statements/sql-statement-drop-database.md) * [CREATE DATABASE](/sql-statements/sql-statement-create-database.md) +* [`INFORMATION_SCHEMA.SCHEMATA`](/information-schema/information-schema-schemata.md) diff --git a/sql-statements/sql-statement-show-privileges.md b/sql-statements/sql-statement-show-privileges.md index 97a6549847af..89d62b0df99d 100644 --- a/sql-statements/sql-statement-show-privileges.md +++ b/sql-statements/sql-statement-show-privileges.md @@ -10,20 +10,18 @@ aliases: ['/docs-cn/dev/sql-statements/sql-statement-show-privileges/','/docs-cn ## 语法图 -**ShowStmt:** - -![ShowStmt](/media/sqlgram/ShowStmt.png) +```ebnf+diagram +ShowPrivilegesStmt ::= + "SHOW" "PRIVILEGES" +``` ## 示例 -{{< copyable "sql" >}} - ```sql -show privileges; +SHOW PRIVILEGES; ``` ```sql -mysql> show privileges; +---------------------------------+---------------------------------------+-------------------------------------------------------+ | Privilege | Context | Comment | +---------------------------------+---------------------------------------+-------------------------------------------------------+ @@ -87,4 +85,5 @@ mysql> show privileges; ## 另请参阅 * [SHOW GRANTS](/sql-statements/sql-statement-show-grants.md) +* [权限管理](/privilege-management.md) * [`GRANT `](/sql-statements/sql-statement-grant-privileges.md)