Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add docs for the I_S keyword table #15795

Merged
merged 13 commits into from
Jan 10, 2024
1 change: 1 addition & 0 deletions TOC-tidb-cloud.md
Original file line number Diff line number Diff line change
Expand Up @@ -543,6 +543,7 @@
- [`DDL_JOBS`](/information-schema/information-schema-ddl-jobs.md)
- [`DEADLOCKS`](/information-schema/information-schema-deadlocks.md)
- [`ENGINES`](/information-schema/information-schema-engines.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
1 change: 1 addition & 0 deletions TOC.md
Original file line number Diff line number Diff line change
Expand Up @@ -927,6 +927,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
48 changes: 48 additions & 0 deletions information-schema/information-schema-keywords.md
dveeden marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
---
title: KEYWORDS
summary: Learn the `KEYWORDS` INFORMATION_SCHEMA table.
---

# KEYWORDS

Starting from v7.6.0, TiDB provides the `KEYWORDS` table. You can use this table to get information about [keywords](/keywords.md) in TiDB.

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

The output is as follows:

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

dveeden marked this conversation as resolved.
Show resolved Hide resolved
Field description:
Oreoxmt marked this conversation as resolved.
Show resolved Hide resolved

- `WORD`: The keyword.
- `RESERVED`: Whether the keyword is reserved.

The following statement queries the information about `ADD` and `USER` keywords:

```sql
SELECT * FROM INFORMATION_SCHEMA.KEYWORDS WHERE WORD IN ('ADD','USER');
```

dveeden marked this conversation as resolved.
Show resolved Hide resolved
From the output, you can see that `ADD` is a reserved keyword and `USER` is a non-reserved keyword.

```
+------+----------+
| 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 @@ -28,6 +28,7 @@ Many `INFORMATION_SCHEMA` tables have a corresponding `SHOW` command. The benefi
| `FILES` | Not implemented by TiDB. Returns zero rows. |
| `GLOBAL_STATUS` | Not implemented by TiDB. Returns zero rows. |
| `GLOBAL_VARIABLES` | Not implemented by TiDB. Returns zero rows. |
| [`KEYWORDS`](/information-schema/information-schema-keywords.md) | Provides a full list of keywords. |
| [`KEY_COLUMN_USAGE`](/information-schema/information-schema-key-column-usage.md) | Describes the key constraints of the columns, such as the primary key constraint. |
| `OPTIMIZER_TRACE` | Not implemented by TiDB. Returns zero rows. |
| `PARAMETERS` | Not implemented by TiDB. Returns zero rows. |
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)
```

Starting from v7.6.0, TiDB provides a full list of keywords in the [`INFORMATION_SCHEMA.KEYWORDS`](/information-schema/information-schema-keywords.md) table.

## Keyword list

The following list shows the keywords in TiDB. Reserved keywords are marked with `(R)`. Reserved keywords for [Window Functions](/functions-and-operators/window-functions.md) are marked with `(R-Window)`. Special non-reserved keywords that need to be escaped with backticks `` ` `` are marked with `(S)`.
Expand Down
Loading