SHOW CHARACTER SET
SHOW CHARACTER SET 语句提供 TiDB 中可用字符集的静态列表。此列表不反映当前连接或用户的任何属性。
语法图
ShowCharsetStmt

ShowLikeOrWhere

1. ShowCharsetStmt ::=
2. "SHOW" ( ("CHARACTER" | "CHAR") "SET" | "CHARSET" ) ShowLikeOrWhere?
4. ShowLikeOrWhere ::=
5. "LIKE" SimpleExpr
6. | "WHERE" Expression
示例
1. SHOW CHARACTER SET;
1. +---------+---------------+-------------------+--------+
2. | Charset | Description | Default collation | Maxlen |
3. +---------+---------------+-------------------+--------+
4. | utf8 | UTF-8 Unicode | utf8_bin | 3 |
5. | utf8mb4 | UTF-8 Unicode | utf8mb4_bin | 4 |
6. | ascii | US ASCII | ascii_bin | 1 |
7. | latin1 | Latin1 | latin1_bin | 1 |
8. | binary | binary | binary | 1 |
9. +---------+---------------+-------------------+--------+
10. 5 rows in set (0.00 sec)
1. SHOW CHARACTER SET LIKE 'utf8%';
1. +---------+---------------+-------------------+--------+
2. | Charset | Description | Default collation | Maxlen |
3. +---------+---------------+-------------------+--------+
4. | utf8 | UTF-8 Unicode | utf8_bin | 3 |
5. | utf8mb4 | UTF-8 Unicode | utf8mb4_bin | 4 |
6. +---------+---------------+-------------------+--------+
7. 2 rows in set (0.00 sec)
1. SHOW CHARACTER SET WHERE Description='UTF-8 Unicode';
1. +---------+---------------+-------------------+--------+
2. | Charset | Description | Default collation | Maxlen |
3. +---------+---------------+-------------------+--------+
4. | utf8 | UTF-8 Unicode | utf8_bin | 3 |
5. | utf8mb4 | UTF-8 Unicode | utf8mb4_bin | 4 |
6. +---------+---------------+-------------------+--------+
7. 2 rows in set (0.00 sec)
MySQL 兼容性
SHOW CHARACTER SET 语句功能与 MySQL 完全兼容。注意,TiDB 中字符集的默认排序规则与 MySQL 有所不同,具体可以参考与 MySQL 兼容性对比。如发现任何兼容性差异,请尝试 TiDB 支持资源。
