Skip to content

Commit

Permalink
Add docs for the I_S keyword table
Browse files Browse the repository at this point in the history
Signed-off-by: Aolin <[email protected]>
  • Loading branch information
Oreoxmt committed Dec 20, 2023
1 parent 9d62898 commit f886ade
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 0 deletions.
1 change: 1 addition & 0 deletions TOC.md
Original file line number Diff line number Diff line change
Expand Up @@ -942,6 +942,7 @@
- [`INSPECTION_RESULT`](/information-schema/information-schema-inspection-result.md)
- [`INSPECTION_RULES`](/information-schema/information-schema-inspection-rules.md)
- [`INSPECTION_SUMMARY`](/information-schema/information-schema-inspection-summary.md)
- [`KEYWORDS`](/information-schema/information-schema-keywords.md)
- [`KEY_COLUMN_USAGE`](/information-schema/information-schema-key-column-usage.md)
- [`MEMORY_USAGE`](/information-schema/information-schema-memory-usage.md)
- [`MEMORY_USAGE_OPS_HISTORY`](/information-schema/information-schema-memory-usage-ops-history.md)
Expand Down
43 changes: 43 additions & 0 deletions information-schema/information-schema-keywords.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
---
title: KEYWORDS
summary: 了解 INFORMATION_SCHEMA 表 `KEYWORDS`。
---

# KEYWORDS

TiDB 从 v7.6.0 开始提供 `KEYWORDS` 表,你可以使用该表查看[关键字](/keywords.md)的信息。

```sql
USE INFORMATION_SCHEMA;
DESC keywords;
```

输出结果如下:

```
+----------+--------------+------+------+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+----------+--------------+------+------+---------+-------+
| WORD | varchar(128) | YES | | NULL | |
| RESERVED | int(11) | YES | | NULL | |
+----------+--------------+------+------+---------+-------+
2 rows in set (0.00 sec)
```

下面的 SQL 语句查询 `ADD``USER` 关键字的信息:

```sql
SELECT * FROM keywords WHERE WORD IN ('ADD','USER');
```

输出结果显示 `ADD` 是一个保留关键字,`USER` 是一个非保留关键字。

```
+------+----------+
| WORD | RESERVED |
+------+----------+
| ADD | 1 |
| USER | 0 |
+------+----------+
2 rows in set (0.00 sec)
```
1 change: 1 addition & 0 deletions information-schema/information-schema.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ Information Schema 提供了一种查看系统元数据的 ANSI 标准方法。
| `FILES` | TiDB 未实现,返回零行。 |
| `GLOBAL_STATUS` | TiDB 未实现,返回零行。 |
| `GLOBAL_VARIABLES` | TiDB 未实现,返回零行。 |
| [`KEYWORDS`](/information-schema/information-schema-keywords.md) | 提供关键字列表。 |
| [`KEY_COLUMN_USAGE`](/information-schema/information-schema-key-column-usage.md) | 描述列的键约束,例如主键约束。 |
| `OPTIMIZER_TRACE` | TiDB 未实现,返回零行。 |
| `PARAMETERS` | TiDB 未实现,返回零行。 |
Expand Down
2 changes: 2 additions & 0 deletions keywords.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ CREATE TABLE test.select (BEGIN int, END int);
Query OK, 0 rows affected (0.08 sec)
```

TiDB 从 v7.6.0 开始提供 [`INFORMATION_SCHEMA.KEYWORDS`](/information-schema/information-schema-keywords.md) 表,其中包含了所有关键字的信息。

## 关键字列表

下表列出了 TiDB 中所有的关键字。其中保留字用 `(R)` 来标识。[窗口函数](/functions-and-operators/window-functions.md)的保留字用 `(R-Window)` 来标识。需要用反引号 `` ` `` 包裹的特殊非保留字用 `(S)` 来标识。
Expand Down

0 comments on commit f886ade

Please sign in to comment.