Mysql query case

Source: Internet
Author: User

The case sensitivity issue of mysql queries is a common problem. We will analyze several common cases of mysql queries by case. I hope this will help you learn about the case sensitivity issue of mysql queries.

Mysql queries are case-insensitive by default, for example:

 
 
  1. select    from   table_name where   a like   ' a'       
  2. select    from   table_name where   a like   ' a'       
  3. select   from table_name where a like ' a'   
  4. select   from table_name where a like ' a'   

The results are the same.

To make mysql queries case sensitive, you can:

 
 
  1. select    from   table_name where   binary   a like   ' a'       
  2. select    from   table_name where   binary   a like   ' a'       
  3. select   from table_name where binary a like ' a'   
  4. select   from table_name where binary a like ' a'   
  5.  

You can also identify a table when creating it.

 
 
  1. create   table   table_name(     
  2.        a varchar (20) binary       
  3. )   

Implementation of MySQL random Query

Example of the number of MySQL query results

Optimization of MySQL query Paging

MySQL query results are sorted by a certain value

Use functions to query row numbers in MySQL

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.