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

Character set and sorting rules of Database built by mysql

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

Share

Shulou(Shulou.com)06/01 Report--

1. Character set description:

Generally choose utf8. Here's the difference between utf8 and utfmb4.

Utf8mb4 is compatible with utf8 and can represent more characters than utf8.

The unicode coding area belongs to the traditional utf8 area from 1 to 126. of course, utf8mb4 is also compatible with this area. below 126 lines is the utf8mb4 extension area. When you need to store those characters, you use utf8mb4, otherwise it's just a waste of space.

two。 Sorting rules

There are generally two kinds of sorting: utf_bin and utf_general_ci

Bin is binary, so an and A will be treated differently.

For example, you run:

SELECT * FROM table WHERE txt ='a'

Then you can't find the line txt ='A'in utf8_bin, but utf8_general_ci can.

Utf8_general_ci is case-insensitive, which you need to use when registering a user name and email.

Utf8_general_cs is case-sensitive. If you use this for your user name and mailbox, it will lead to adverse consequences.

Utf8_bin: string each string is compiled and stored with binary data. Case-sensitive and can store binary content

There is no real difference between utf8_unicode_ci and utf8_general_ci in Chinese and English.

The proofreading speed of utf8_general_ci is fast, but the accuracy is slightly lower. (the accuracy is enough, generally choose this to build the database)

The accuracy of utf8_unicode_ci is high, but the proofreading speed is slow.

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