In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-11 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)05/31 Report--
This article introduces the relevant knowledge of "what is the collation of mysql". In the operation of actual cases, many people will encounter such a dilemma. Then 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!
The collation of mysql roughly means character order. First of all, characters are of no size, so the >, =, and < operations of characters need to have a rule of character order. That's what collation does. You can set the character order of a table or a field alone. A character type that has multiple character orders, such as:
Here is the character order corresponding to UTF8.
Utf8_general_ci utf8 33 Yes Yes 1
Utf8_bin utf8 83 Yes 1
Utf8_unicode_ci utf8 192 Yes 8
Utf8_icelandic_ci utf8 193 Yes 8
Utf8_latvian_ci utf8 194 Yes 8
Utf8_romanian_ci utf8 195 Yes 8
Utf8_slovenian_ci utf8 196 Yes 8
Utf8_polish_ci utf8 197 Yes 8
Utf8_estonian_ci utf8 198 Yes 8
Utf8_spanish_ci utf8 199 Yes 8
Utf8_swedish_ci utf8 200 Yes 8
Utf8_turkish_ci utf8 201 Yes 8
Utf8_czech_ci utf8 202 Yes 8
Utf8_danish_ci utf8 203 Yes 8
Utf8_lithuanian_ci utf8 204 Yes 8
Utf8_slovak_ci utf8 205 Yes 8
Utf8_spanish3_ci utf8 206 Yes 8
Utf8_roman_ci utf8 207 Yes 8
Utf8_persian_ci utf8 208 Yes 8
Utf8_esperanto_ci utf8 209 Yes 8
Utf8_hungarian_ci utf8 210 Yes 8
Utf8_sinhala_ci utf8 211 Yes 8
Utf8_german2_ci utf8 212 Yes 8
Utf8_croatian_ci utf8 213 Yes 8
Utf8_unicode_520_ci utf8 214 Yes 8
Utf8_vietnamese_ci utf8 215 Yes 8
Utf8_general_mysql500_ci utf8 223 Yes 1
The character order of mysql follows the naming convention. Use _ ci (for case insensitivity), _ cs (for case sensitivity), and _ bin (for comparison with coded values). For example:
CREATE TABLE `issue_ message` (
`id`int (11) NOT NULL AUTO_INCREMENT
`content` varchar (255) NOT NULL
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8
The two sql below this table will show the same result.
Select * from issue_message where content = 'Yes'
Select * from issue_message where content = 'yes'
If changed to the following definition:
CREATE TABLE `issue_ message` (
`id`int (11) NOT NULL AUTO_INCREMENT
`content` varchar (255) NOT NULL COLLATE utf8_bin
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8
Then the results of the two sql will be different.
Therefore, if you are sensitive to character size, it is best to set the default utf8_general_ci in the database to utf8_bin.
This is the end of the content of "what is the collation of mysql". 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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.