Home > Database > Mysql Tutorial > body text

Does MySQL Offer Case-Sensitive Collations, and How Can I Use Them?

Patricia Arquette
Release: 2024-11-22 03:18:10
Original
409 people have browsed it

Does MySQL Offer Case-Sensitive Collations, and How Can I Use Them?

Case Sensitivity in MySQL Collation

MySQL offers a variety of collation types, but determining which one supports case sensitivity can be confusing. This question delves into the availability of case-sensitive collations in MySQL and provides detailed answers.

Answer 1:

According to the MySQL Manual, setting the collation to "_cs" enables case sensitivity. You can view the available _cs collations using the query "SHOW COLLATION WHERE COLLATION LIKE "%_cs"".

Answer 2:

However, further research reveals that there are no utf8_*_cs collations in MySQL. For case-sensitive utf8 fields, "utf8_bin" should be used. While this may disrupt ordering, it can be resolved by using "ORDER BY column COLLATE utf8_general_ci".

Additional Resources:

  • MySQL Manual: https://dev.mysql.com/doc/refman/5.0/en/charset-mysql.html
  • MySQL Forum Thread: https://forums.mysql.com/read.php?103,19380,200971
  • MySQL Forum Thread: https://forums.mysql.com/read.php?103,156527,198794

The above is the detailed content of Does MySQL Offer Case-Sensitive Collations, and How Can I Use Them?. For more information, please follow other related articles on the PHP Chinese website!

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Articles by Author
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template