utf8_bin和utf_unicode_ci [英] utf8_bin vs. utf_unicode_ci

查看:138
本文介绍了utf8_bin和utf_unicode_ci的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的表网站

Website_Name//column name
Google
Facebook
Twitter
Orkut
Frype
Skype
Yahoo
Wikipedia


$ b b

我使用utf8_bin整理,然后我的网站搜索维基百科的查询是

I i use utf8_bin collation then my query to search wikipedia in Website is

Select Website_Name from Website where lower(Website_Name)='wikipedia'

如果我使用utf8_unicode_ci然后我的选择查询搜索维基百科在网站是

And if i use utf8_unicode_ci then my select query to search wikipedia in Website is

Select Website_Name from Website where Website_Name='wikipedia'

现在我想知道哪个整理最好取决于以下查询:

Now I want to know which collation is best depending upon the following queries

推荐答案

这取决于你需要什么。

It depends on what you need.

utf8_bin 排序规则仅根据Unicode的字符串进行比较代码点值。如果所有代码点具有相同的值,则字符串相等。然而,当您具有用于组合标记(组成对比分解)的不同组合的字符串或典型等效但不具有相同代码点值的字符时,这会分开。在某些情况下,使用 utf8_bin 会导致字符串不匹配,当你期望他们。理论上, utf8_bin 是最快的,因为没有Unicode标准化应用于字符串,但它可能不是你想要的。

The utf8_bin collation compares strings based purely on their Unicode code point values. If all of the code points have the same values, then the strings are equal. However, this falls apart when you have strings with different composition for combining marks (composed vs. decomposed) or characters that are canonically equivalent but don't have the same code point value. In some cases, using utf8_bin will result in strings not matching when you expect them to. Theoretically, utf8_bin is the fastest because no Unicode normalization is applied to the strings, but it may not be what you want.

utf8_general_ci 使用特定于语言的规则应用Unicode规范化,并对大小写不敏感的字符串进行比较。 utf8_general_cs 执行相同操作,但区分大小写地比较字符串。

utf8_general_ci applies Unicode normalization using language-specific rules and compares strings case-insensitively. utf8_general_cs does the same, but compares strings case-sensitively.

这篇关于utf8_bin和utf_unicode_ci的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆