How does "MySQL" resolve query case-insensitive issues in MySQL

Source: Internet
Author: User

MySQL queries are case insensitive by default, such as:

Select *  from where Str =' abc'; select * from some_table where str='abc';

The results are the same, and if we need to differentiate, we can do it as follows:

The first method:
To make MySQL queries case-sensitive, you can:

Select *  from where binary Str = ' ABC ' Select *  from where binary Str = ' ABC '

The second method:

To be identified when the table is under construction

Create Table some_table (   strchar)

Principle:

For char, varchar, and text types, the binary attribute can assign a collation to a column for that column's character set. The binary property is shorthand for the two-dollar collation of the specified column character set. Sorting and comparisons are based on numeric character values. So the case is also naturally differentiated.

Original link: MySQL query case-insensitive problem

How does "MySQL" resolve query case-insensitive issues in MySQL

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.