A character set is a set of symbols

and encodings. A collation is a set of

rules for comparing characters in a

character set. Let’s make the

distinction clear with an example of

an imaginary character set.

Suppose that we have an alphabet with

four letters: ‘A’, ‘B’, ‘a’, ‘b’. We

give each letter a number: ‘A’ = 0,

‘B’ = 1, ‘a’ = 2, ‘b’ = 3. The letter

‘A’ is a symbol, the number 0 is the

encoding for ‘A’, and the combination

of all four letters and their

encodings is a character set.

Now, suppose that we want to compare

two string values, ‘A’ and ‘B’. The

simplest way to do this is to look at

the encodings: 0 for ‘A’ and 1 for

‘B’. Because 0 is less than 1, we say

‘A’ is less than ‘B’. Now, what we’ve

just done is apply a collation to our

character set. The collation is a set

of rules (only one rule in this case):

“compare the encodings.” We call this

simplest of all possible collations a

binary collation.

But what if we want to say that the

lowercase and uppercase letters are

equivalent? Then we would have at

least two rules: (1) treat the

lowercase letters ‘a’ and ‘b’ as

equivalent to ‘A’ and ‘B’; (2) then

compare the encodings. We call this a

case-insensitive collation. It’s a

little more complex than a binary

collation.

In real life, most character sets have many characters: not just ‘A’ and ‘B’ but whole alphabets, sometimes multiple alphabets or eastern writing systems with thousands of characters, along with many special symbols and punctuation marks. Also in real life, most collations have many rules: not just case insensitivity but also accent insensitivity (an “accent” is a mark attached to a character as in German ‘ö’) and multiple-character mappings (such as the rule that ‘ö’ = ‘OE’ in one of the two German collations).

mysql排序规则选什么区别_mysql – 字符集和排序规则是什么意思?相关推荐

  1. mysql默认字符集和排序_MySQL字符集和排序规则

    MySQL在创建数据库是,需要设置数据库的字符集和排序规则,如图所示: 我觉得这里有必要解释下字符集和排序规则这两个概念. 字符集 说到字符集,需要先提下字符.字符集和字符编码这几个词的含义. 字符( ...

  2. mysql连接校对_mysql字符集和校对规则(Mysql校对集)

    字符集的概念大家都清楚,校对规则很多人不了解,一般数据库开发中也用不到这个概念,mysql在这方便貌似很先进,大概介绍一下 简要说明 字符集和校对规则 字符集是一套符号和编码.校对规则是在字符集内用于 ...

  3. 修改表名_面试官:如何批量修改mysql表字段、表、数据库字符集和排序规则

    概述 目前数据库字符集统一用的utf8,由于项目需要,引进了表情,但是utf8mb5才支持表情字符,所以需统一修改数据库字符集,下面介绍批量修改数据库字符集的办法. 修正顺序是字段级别>表级别& ...

  4. MySQL 批量修改数据库的字符集和排序规则

    推荐阅读 Helm3(K8S 资源对象管理工具)视频教程:https://edu.csdn.net/course/detail/32506 Helm3(K8S 资源对象管理工具)博客专栏:https: ...

  5. MySQL中支持的字符集和排序规则

    一.MySQL字符集概念 1.1 MySQL中的utf8和utf8mb4 我们常说 utf8 字符集表示一个字符需要使用1-4个字节,但是我们常用的一些字符使用1-3个字节就可以表示了.而在 MySQ ...

  6. mysql 字符集和校对规则

    为什么80%的码农都做不了架构师?>>>    1,常规字符集及校对 假设我们有一个字母表使用了四个字母:'A'.'B'.'a'.'b'.我们为每个字母赋予一个数值:'A'=0,'B ...

  7. MySQL字符集和校对规则(Collation)

    MySQL字符集和校对规则(Collation) 阅读目录:MySQL的字符集和校对规则 MySQL的字符集 MySQL与字符集 正确使用字符集 MySQL客户端与字符集 字符集编码转换原理 字符集常 ...

  8. 13、设置默认字符集和校对规则

    MySQL 服务器可以支持多种字符集,在同一台服务器.同一个数据库甚至同一个表的不同字段中,都可以使用不同的字符集.Oracle 等其它数据库管理系统都只能使用相同的字符集,相比之下,MySQL 明显 ...

  9. mysql 中文字符排序规则_mysql中字符集和排序规则说明

    数据库需要适应各种语言和字符就需要支持不同的字符集(Character Set),每种字符集也有各自的排序规则(Collation). 一.字符集 字符集,即用于定义字符在数据库中的编码的集合. 常见 ...

最新文章

  1. bzoj1334[Baltic2008]Elect(背包dp)
  2. Sqlserver 通用存储过程(二) 联合主键
  3. Redis应用场景(转)
  4. 存储技术论坛:最高可用级别的同步复制及方案
  5. select2插件+ajax笔记
  6. java版本位数_java 如何查看jdk版本位数
  7. app测试和web测试的区别
  8. 数据安全之数据分类分级系统建设
  9. 歌曲:酒干倘卖无 背后的故事
  10. 判断字符串子序列--HW
  11. 被举报了,越想越后怕...
  12. 51单片机 (九)定时器
  13. SLAM-Visual Navigation学习之SIFT算法与代码详解
  14. Android 平台电容式触摸屏硬件基本原理
  15. 蓝桥杯 — 星系炸弹( 在X星系的广袤空间中漂浮着许多X星人造“炸弹”)
  16. Comsol学习——Comsol基础建模流程
  17. spark Error initializing SparkContext System memory 466092032 must be at least 471859200.
  18. 【读书笔记】【WebKit技术内 幕(二)】Chromium Webkit资源加载与网络栈、DOM树、HTML解释器、影子DOM、CSS解释器和样式布局、网页层次与渲染、绘图上下文、
  19. GeneratorMapper.xml配置文件
  20. 练习三:输入一个数,输出它的绝对值

热门文章

  1. framework —— auth认证
  2. RabbitMQ官方教程一 Hello World!
  3. 寒假作业3(传说中的写软件)
  4. 《程序设计技术》第七章例程
  5. POJ NOI0101-09 字符菱形
  6. LBP(Local Binary Patterns)局部二进制模式
  7. C++ 标准库 —— random
  8. 机器学习基础(三十四)—— 协同过滤(之获得推荐)
  9. 工具的使用——搜狗输入法
  10. Beta-Binomial 共轭