Case Sensitive collation in MySQL(MySQL 中区分大小写的排序规则)
问题描述
MySQL 中是否有任何支持区分大小写的排序规则类型.我在 MySQL 中有所有类型的排序规则,它们的名称末尾都有 _ci,因此它们是不区分大小写的排序规则.
Is there any Collation type in MySQL which supports Case Sensitive. I had all type of collation in MySQL they all have _ci at the end of their name so they are case Insensitive collation.
推荐答案
根据 MySQL 手册 http://dev.mysql.com/doc/refman/5.0/en/charset-mysql.html 你应该能够将排序规则设置为 _cs
区分大小写.您可以通过执行 SHOW COLLATION WHERE COLLATION LIKE "%_cs"
查询来获取 _cs
排序规则的列表
According to MySQL Manual http://dev.mysql.com/doc/refman/5.0/en/charset-mysql.html you should be able to set collation to _cs
for case sensitivity. You can get a list of _cs
collations by executing SHOW COLLATION WHERE COLLATION LIKE "%_cs"
query
经过一些研究:
显然 MySQL 中没有 utf8_*_cs
(目前).如果您需要 utf8 字段区分大小写的排序规则,您应该使用 utf8_bin
.这会弄乱ORDER BY
,但这可以通过ORDER BY column COLLATE utf8_general_ci
Apparently there are no utf8_*_cs
in MySQL (yet). If you need case sensitive collation for utf8 fields, you should use utf8_bin
. This will mess up ORDER BY
, but this can be fixed by ORDER BY column COLLATE utf8_general_ci
来源:http://forums.mysql.com/read.php?103,19380,200971#msg-200971 和 http://forums.mysql.com/read.php?103,156527,198794#msg-198794
这篇关于MySQL 中区分大小写的排序规则的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:MySQL 中区分大小写的排序规则


基础教程推荐
- 如何在 SQL Server 的嵌套过程中处理事务? 2021-01-01
- 无法在 ubuntu 中启动 mysql 服务器 2021-01-01
- SQL Server 2016更改对象所有者 2022-01-01
- 将数据从 MS SQL 迁移到 PostgreSQL? 2022-01-01
- 使用pyodbc“不安全"的Python多处理和数据库访问? 2022-01-01
- SQL Server 中单行 MERGE/upsert 的语法 2021-01-01
- Sql Server 字符串到日期的转换 2021-01-01
- ERROR 2006 (HY000): MySQL 服务器已经消失 2021-01-01
- SQL Server:只有 GROUP BY 中的最后一个条目 2021-01-01
- 在 VB.NET 中更新 SQL Server DateTime 列 2021-01-01