Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use collation and Character set of mysql

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)05/31 Report--

This article introduces the knowledge of "how to use collation and Character set of mysql". Many people will encounter this dilemma in the operation of actual cases, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!

Collation and Character set

The collation of mysql roughly means character order. First of all, the character is regardless of size, so for the character >, =

< 操作就需要有个字符序的规则。collation做的就是这个事情,你可以对表进行字符序的设置,也可以单独对某个字段进行字符序的设置。 mysql的字符序遵从命名惯例。以_ci(表示大小写不敏感),以_cs(表示大小写敏感),以_bin(表示用编码值进行比较)。(ci 是 case insensitive 的缩写, cs 是 case sensitive 的缩写)。 collation 名字的规则可以归纳为这两类: 1. __ 2. _bin 查询character set 与 collation的对应关系: mysql>

Show collation

1. When the character set of the table is latin1, if the field type is nvarchar, the character set of the field automatically changes to utf8. It can be seen that database character set, table character set and field character set can be covered step by step.

two。 How to distinguish case in comparison under the collation of ci

Method 1:

Mysql > select * from pet where binary name = 'Histler'

Method two

Mysql > select * from pet where name = binary 'Histler'

It is recommended to use method 2, which ensures that the index of the current field is still valid, and the method will invalidate the index.

This is the end of "how to use mysql's collation and Character set". Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report