MySQL Case-sensitive search

Source: Internet
Author: User
Tags uppercase character

Form:http://www.uphtm.com/database/257.html

By default, MySQL search is case-insensitive (but some character sets are always case-sensitive, such as Czech). This means that if you are searching using col_name like ' a% ', you will get all columns starting with a or a. If you intend to make the search case-sensitive, make sure that one of the operands has case-sensitive or binary proofing. For example, if you are comparing columns and strings that are applicable to the Latin1 character set, you can use the COLLATE operator to make 1 operands have latin1_general_cs or latin1_bin proofing characteristics. For example:

  1. Col_name COLLATE latin1_general_cs like ' a% ';
  2. Col_name COLLATE latin1_general_cs like ' a% ';
  3. Col_name COLLATE latin1_bin like ' a% ';
  4. Col_name like ' a% ' COLLATE latin1_bin;

If you want to always handle a column in a case-sensitive manner, you can declare it with case-sensitive or binary proofing.

Simple comparison operations (>=,;, =, <, <=, sorting, and grouping) are based on the "sort value" of each character. Characters with the same sort values (such as ' e ', ' e ', and ' é ') will be treated as the same uppercase character.

Form:http://www.uphtm.com

MySQL Case-sensitive search

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.