- MySQL 基础
- MySQL - 首页
- MySQL - 简介
- MySQL - 特性
- MySQL - 版本
- MySQL - 变量
- MySQL - 安装
- MySQL - 管理
- MySQL - PHP 语法
- MySQL - Node.js 语法
- MySQL - Java 语法
- MySQL - Python 语法
- MySQL - 连接
- MySQL - Workbench
- MySQL 数据库
- MySQL - 创建数据库
- MySQL - 删除数据库
- MySQL - 选择数据库
- MySQL - 显示数据库
- MySQL - 复制数据库
- MySQL - 数据库导出
- MySQL - 数据库导入
- MySQL - 数据库信息
- MySQL 用户
- MySQL - 创建用户
- MySQL - 删除用户
- MySQL - 显示用户
- MySQL - 修改密码
- MySQL - 授予权限
- MySQL - 显示权限
- MySQL - 收回权限
- MySQL - 锁定用户账户
- MySQL - 解锁用户账户
- MySQL 表
- MySQL - 创建表
- MySQL - 显示表
- MySQL - 修改表
- MySQL - 重命名表
- MySQL - 克隆表
- MySQL - 截断表
- MySQL - 临时表
- MySQL - 修复表
- MySQL - 描述表
- MySQL - 添加/删除列
- MySQL - 显示列
- MySQL - 重命名列
- MySQL - 表锁定
- MySQL - 删除表
- MySQL - 派生表
- MySQL 查询
- MySQL - 查询
- MySQL - 约束
- MySQL - 插入查询
- MySQL - 选择查询
- MySQL - 更新查询
- MySQL - 删除查询
- MySQL - 替换查询
- MySQL - 插入忽略
- MySQL - 插入重复键更新
- MySQL - 插入到选择
- MySQL 运算符和子句
- MySQL - WHERE 子句
- MySQL - LIMIT 子句
- MySQL - DISTINCT 子句
- MySQL - ORDER BY 子句
- MySQL - GROUP BY 子句
- MySQL - HAVING 子句
- MySQL - AND 运算符
- MySQL - OR 运算符
- MySQL - LIKE 运算符
- MySQL - IN 运算符
- MySQL - ANY 运算符
- MySQL - EXISTS 运算符
- MySQL - NOT 运算符
- MySQL - 不等于运算符
- MySQL - IS NULL 运算符
- MySQL - IS NOT NULL 运算符
- MySQL - BETWEEN 运算符
- MySQL - UNION 运算符
- MySQL - UNION 与 UNION ALL
- MySQL - MINUS 运算符
- MySQL - INTERSECT 运算符
- MySQL - INTERVAL 运算符
- MySQL 连接
- MySQL - 使用连接
- MySQL - INNER JOIN
- MySQL - LEFT JOIN
- MySQL - RIGHT JOIN
- MySQL - CROSS JOIN
- MySQL - FULL JOIN
- MySQL - 自连接
- MySQL - 删除连接
- MySQL - 更新连接
- MySQL - UNION 与 JOIN
- MySQL 触发器
- MySQL - 触发器
- MySQL - 创建触发器
- MySQL - 显示触发器
- MySQL - 删除触发器
- MySQL - 插入前触发器
- MySQL - 插入后触发器
- MySQL - 更新前触发器
- MySQL - 更新后触发器
- MySQL - 删除前触发器
- MySQL - 删除后触发器
- MySQL 数据类型
- MySQL - 数据类型
- MySQL - VARCHAR
- MySQL - BOOLEAN
- MySQL - ENUM
- MySQL - DECIMAL
- MySQL - INT
- MySQL - FLOAT
- MySQL - BIT
- MySQL - TINYINT
- MySQL - BLOB
- MySQL - SET
- MySQL 正则表达式
- MySQL - 正则表达式
- MySQL - RLIKE 运算符
- MySQL - NOT LIKE 运算符
- MySQL - NOT REGEXP 运算符
- MySQL - regexp_instr() 函数
- MySQL - regexp_like() 函数
- MySQL - regexp_replace() 函数
- MySQL - regexp_substr() 函数
- MySQL 函数和运算符
- MySQL - 日期和时间函数
- MySQL - 算术运算符
- MySQL - 数字函数
- MySQL - 字符串函数
- MySQL - 聚合函数
- MySQL 其他概念
- MySQL - NULL 值
- MySQL - 事务
- MySQL - 使用序列
- MySQL - 处理重复项
- MySQL - SQL 注入
- MySQL - 子查询
- MySQL - 注释
- MySQL - 检查约束
- MySQL - 存储引擎
- MySQL - 将表导出到 CSV 文件
- MySQL - 将 CSV 文件导入到数据库
- MySQL - UUID
- MySQL - 公共表表达式
- MySQL - ON DELETE CASCADE
- MySQL - Upsert
- MySQL - 水平分区
- MySQL - 垂直分区
- MySQL - 游标
- MySQL - 存储函数
- MySQL - Signal
- MySQL - Resignal
- MySQL - 字符集
- MySQL - 校对
- MySQL - 通配符
- MySQL - 别名
- MySQL - ROLLUP
- MySQL - 当天日期
- MySQL - 字面量
- MySQL - 存储过程
- MySQL - Explain
- MySQL - JSON
- MySQL - 标准差
- MySQL - 查找重复记录
- MySQL - 删除重复记录
- MySQL - 选择随机记录
- MySQL - 显示 Processlist
- MySQL - 更改列类型
- MySQL - 重置自动递增
- MySQL - Coalesce() 函数
- MySQL 有用资源
- MySQL - 有用函数
- MySQL - 语句参考
- MySQL - 快速指南
- MySQL - 有用资源
- MySQL - 讨论
MySQL - SHOW COLLATION 语句
MySQL SHOW COLLATION 语句
MySQL 校对是一组用于验证/比较字符集每个字符的规则。每个字符集至少有一个校对(它可以有多个)和一个默认校对。没有两个字符集可以具有相同的校对。
SHOW COLLATION 语句显示服务器支持的校对列表。除了可用校对的名称外,此语句还提供以下详细信息:
Charset - 字符集名称。
Id - 校对的 ID
Default - 一个布尔值,表示给定的校对是否为字符集的默认值。
Compiled - 一个布尔值,指定字符集是否已编译到服务器中。
Sortlen - 一个整数值,指定对字符集中的字符串进行排序所需的内存量。
语法
以下是 SHOW COLLATION 语句的语法:
SHOW COLLATION [LIKE 'pattern' | WHERE expr]
示例
您可以使用以下查询获取当前数据库中所有可用的校对(以及上面提到的其他详细信息):
SHOW COLLATION\G;
输出
以下是上述查询的输出:
************ 1. row ************
Collation: armscii8_bin
Charset: armscii8
Id: 64
Default:
Compiled: Yes
Sortlen: 1
Pad_attribute: PAD SPACE
************ 2. row ************
Collation: armscii8_general_ci
Charset: armscii8
Id: 32
Default: Yes
Compiled: Yes
Sortlen: 1
Pad_attribute: PAD SPACE
************ 3. row ************
Collation: ascii_bin
Charset: ascii
Id: 65
Default:
Compiled: Yes
Sortlen: 1
Pad_attribute: PAD SPACE
************ 4. row ************
Collation: ascii_general_ci
Charset: ascii
Id: 11
Default: Yes
Compiled: Yes
Sortlen: 1
Pad_attribute: PAD SPACE
************ 5. row ************
Collation: big5_bin
Charset: big5
Id: 84
Default:
Compiled: Yes
Sortlen: 1
Pad_attribute: PAD SPACE
************ 6. row ************
Collation: big5_chinese_ci
Charset: big5
Id: 1
Default: Yes
Compiled: Yes
Sortlen: 1
Pad_attribute: PAD SPACE
************ 7. row ************
Collation: binary
Charset: binary
Id: 63
Default: Yes
Compiled: Yes
Sortlen: 1
Pad_attribute: NO PAD
************ 8. row ************
Collation: cp1250_bin
Charset: cp1250
Id: 66
Default:
Compiled: Yes
Sortlen: 1
Pad_attribute: PAD SPACE
************ 9. row ************
Collation: cp1250_croatian_ci
Charset: cp1250
Id: 44
Default:
Compiled: Yes
Sortlen: 1
Pad_attribute: PAD SPACE
************ 10. row ************
Collation: cp1250_czech_cs
Charset: cp1250
Id: 34
Default:
Compiled: Yes
Sortlen: 2
Pad_attribute: PAD SPACE
************ 11. row ************
Collation: cp1250_general_ci
Charset: cp1250
Id: 26
Default: Yes
Compiled: Yes
Sortlen: 1
Pad_attribute: PAD SPACE
************ 12. row ************
Collation: cp1250_polish_ci
Charset: cp1250
Id: 99
Default:
Compiled: Yes
Sortlen: 1
Pad_attribute: PAD SPACE
************ 13. row ************
Collation: cp1251_bin
Charset: cp1251
Id: 50
Default:
Compiled: Yes
Sortlen: 1
Pad_attribute: PAD SPACE
************ 14. row ************
Collation: cp1251_bulgarian_ci
Charset: cp1251
Id: 14
Default:
Compiled: Yes
Sortlen: 1
Pad_attribute: PAD SPACE
************ 15. row ************
Collation: cp1251_general_ci
Charset: cp1251
Id: 51
Default: Yes
Compiled: Yes
Sortlen: 1
Pad_attribute: PAD SPACE
************ 16. row ************
Collation: cp1251_general_cs
Charset: cp1251
Id: 52
Default:
Compiled: Yes
Sortlen: 1
Pad_attribute: PAD SPACE
************ 17. row ************
Collation: cp1251_ukrainian_ci
Charset: cp1251
Id: 23
Default:
Compiled: Yes
Sortlen: 1
Pad_attribute: PAD SPACE
************ 18. row ************
Collation: cp1256_bin
Charset: cp1256
Id: 67
Default:
Compiled: Yes
Sortlen: 1
Pad_attribute: PAD SPACE
************ 19. row ************
Collation: cp1256_general_ci
Charset: cp1256
Id: 57
Default: Yes
Compiled: Yes
Sortlen: 1
Pad_attribute: PAD SPACE
************ 20. row ************
Collation: cp1257_bin
Charset: cp1257
Id: 58
Default:
Compiled: Yes
Sortlen: 1
Pad_attribute: PAD SPACE
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . .
LIKE 子句
使用 LIKE 子句,您可以指定一个模式来检索与给定模式匹配的校对的名称和其他详细信息。
SHOW COLLATION LIKE 'utf32%'\G;
输出
上述查询产生以下输出:
************* 1. row *************
Collation: utf32_bin
Charset: utf32
Id: 61
Default:
Compiled: Yes
Sortlen: 1
Pad_attribute: PAD SPACE
************* 2. row *************
Collation: utf32_croatian_ci
Charset: utf32
Id: 181
Default:
Compiled: Yes
Sortlen: 8
Pad_attribute: PAD SPACE
************* 3. row *************
Collation: utf32_czech_ci
Charset: utf32
Id: 170
Default:
Compiled: Yes
Sortlen: 8
Pad_attribute: PAD SPACE
************* 4. row *************
Collation: utf32_danish_ci
Charset: utf32
Id: 171
Default:
Compiled: Yes
Sortlen: 8
Pad_attribute: PAD SPACE
************* 5. row *************
Collation: utf32_esperanto_ci
Charset: utf32
Id: 177
Default:
Compiled: Yes
Sortlen: 8
Pad_attribute: PAD SPACE
************* 6. row *************
Collation: utf32_estonian_ci
Charset: utf32
Id: 166
Default:
Compiled: Yes
Sortlen: 8
Pad_attribute: PAD SPACE
************* 7. row *************
Collation: utf32_general_ci
Charset: utf32
Id: 60
Default: Yes
Compiled: Yes
Sortlen: 1
Pad_attribute: PAD SPACE
************* 8. row *************
Collation: utf32_german2_ci
Charset: utf32
Id: 180
Default:
Compiled: Yes
Sortlen: 8
Pad_attribute: PAD SPACE
************* 9. row *************
Collation: utf32_hungarian_ci
Charset: utf32
Id: 178
Default:
Compiled: Yes
Sortlen: 8
Pad_attribute: PAD SPACE
************* 10. row *************
Collation: utf32_icelandic_ci
Charset: utf32
Id: 161
Default:
Compiled: Yes
Sortlen: 8
Pad_attribute: PAD SPACE
************* 11. row *************
Collation: utf32_latvian_ci
Charset: utf32
Id: 162
Default:
Compiled: Yes
Sortlen: 8
Pad_attribute: PAD SPACE
************* 12. row *************
Collation: utf32_lithuanian_ci
Charset: utf32
Id: 172
Default:
Compiled: Yes
Sortlen: 8
Pad_attribute: PAD SPACE
************* 13. row *************
Collation: utf32_persian_ci
Charset: utf32
Id: 176
Default:
Compiled: Yes
Sortlen: 8
Pad_attribute: PAD SPACE
************* 14. row *************
Collation: utf32_polish_ci
Charset: utf32
Id: 165
Default:
Compiled: Yes
Sortlen: 8
Pad_attribute: PAD SPACE
************* 15. row *************
Collation: utf32_romanian_ci
Charset: utf32
Id: 163
Default:
Compiled: Yes
Sortlen: 8
Pad_attribute: PAD SPACE
************* 16. row *************
Collation: utf32_roman_ci
Charset: utf32
Id: 175
Default:
Compiled: Yes
Sortlen: 8
Pad_attribute: PAD SPACE
************* 17. row *************
Collation: utf32_sinhala_ci
Charset: utf32
Id: 179
Default:
Compiled: Yes
Sortlen: 8
Pad_attribute: PAD SPACE
************* 18. row *************
Collation: utf32_slovak_ci
Charset: utf32
Id: 173
Default:
Compiled: Yes
Sortlen: 8
Pad_attribute: PAD SPACE
************* 19. row *************
Collation: utf32_slovenian_ci
Charset: utf32
Id: 164
Default:
Compiled: Yes
Sortlen: 8
Pad_attribute: PAD SPACE
************* 20. row *************
Collation: utf32_spanish2_ci
Charset: utf32
Id: 174
Default:
Compiled: Yes
Sortlen: 8
Pad_attribute: PAD SPACE
************* 21. row *************
Collation: utf32_spanish_ci
Charset: utf32
Id: 167
Default:
Compiled: Yes
Sortlen: 8
Pad_attribute: PAD SPACE
************* 22. row *************
Collation: utf32_swedish_ci
Charset: utf32
Id: 168
Default:
Compiled: Yes
Sortlen: 8
Pad_attribute: PAD SPACE
************* 23. row *************
Collation: utf32_turkish_ci
Charset: utf32
Id: 169
Default:
Compiled: Yes
Sortlen: 8
Pad_attribute: PAD SPACE
************* 24. row *************
Collation: utf32_unicode_520_ci
Charset: utf32
Id: 182
Default:
Compiled: Yes
Sortlen: 8
Pad_attribute: PAD SPACE
************* 25. row *************
Collation: utf32_unicode_ci
Charset: utf32
Id: 160
Default:
Compiled: Yes
Sortlen: 8
Pad_attribute: PAD SPACE
************* 26. row *************
Collation: utf32_vietnamese_ci
Charset: utf32
Id: 183
Default:
Compiled: Yes
Sortlen: 8
Pad_attribute: PAD SPACE
WHERE 子句
您可以使用 SHOW STATUS 语句的 WHERE 子句来检索与指定条件匹配的校对的名称。
SHOW COLLATION WHERE Charset = 'cp1251';
输出
执行上述查询后,它将生成以下输出:
| 校对 | 字符集 | ID | 默认 | 已编译 | Sortlen | Pad_attribute |
|---|---|---|---|---|---|---|
| cp1251_bin | cp1251 | 50 | 是 | 1 | PAD SPACE | |
| cp1251_bulgarian_ci | cp1251 | 14 | 是 | 1 | PAD SPACE | |
| cp1251_general_ci | cp1251 | 51 | 是 | 是 | 1 | PAD SPACE |
| cp1251_general_cs | cp1251 | 52 | 是 | 1 | PAD SPACE | |
| cp1251_ukrainian_ci | cp1251 | 23 | 是 | 1 | PAD SPACE |
广告