[MySQL]:什么是整理方法? [英] [MySQL]: What is collation method?

查看:64
本文介绍了[MySQL]:什么是整理方法?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我使用phpMyAdmin查看我的在线表时,它使用整理方法"latin_swedish_ce".为什么?默认值是多少?而且,使用哪种校对方法?

When I use phpMyAdmin to see my online tables, it uses collation method "latin_swedish_ce". Why? What is the default? And, for what collation method is used?

推荐答案

MySQL中的字符串具有字符集和排序规则. utf8是一个字符集,而utf8_bin是其排序规则之一.排序规则确定MySQL如何比较字符串.

A string in MySQL has a character set and a collation. Utf8 is a character set, and utf8_bin is one of its collations. The collation determines how MySQL compares strings.

例如,以下是比较UTF8字符串的两种方法:

For example, here's two ways to compare a UTF8 string:

select case when 'test' = 'TEST' collate utf8_bin 
       then 'true' else 'false' end,
       case when 'test' = 'TEST' collate utf8_roman_ci 
       then 'true' else 'false' end

第一个使用utf8_bin排序规则,区分大小写.第二个使用不区分大小写的utf8_roman_ci.

The first uses the utf8_bin collation, which is case sensitive. The second uses utf8_roman_ci, which is case insensitive.

可以找到所有字符集和排序规则的列表:

A list of all character sets and collations can be found with:

show character set
show collation

latin1_swedish_ci是默认排序规则(MySQL最初是在瑞典开发的),MariaDB也是如此.

latin1_swedish_ci is the default collation (MySQL was originally developed in Sweden), this is also true for MariaDB.

这篇关于[MySQL]:什么是整理方法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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