Mysql select query case-sensitive methods (1/3)

Source: Internet
Author: User
Tags mysql tutorial

1. You can set collation for a table or row to binary or case sensitive. In the mysql tutorial, the naming conventions for column collate are as follows:

* _ Bin: binary case sensitive collation, that is, case sensitive.
* _ Cs: case sensitive collation, case sensitive
* _ Ci: case insensitive collation, case insensitive

 

###########
# Start binary collation example
###########
Mysql> create table case_bin_test (word varchar (10) character set latin1 collate latin1_bin;
Query OK, 0 rows affected (0.02 sec)

Mysql> insert into case_bin_test values ('frank'), ('Google '), ('froog'), ('flickr'), ('flickr ');
Query OK, 5 rows affected (0.00 sec)
Records: 5 duplicates: 0 warnings: 0

Mysql> select * from case_bin_test where word like 'f % ';
+ --------- +
| Word |
+ --------- +
| Froogle |
| Flickr |
+ --------- +
2 rows in set (0.00 sec)

Mysql> select * from case_bin_test where word like 'f % ';
+ --------- +
| Word |
+ --------- +
| Frank |
| Flickr |
+ --------- +
4 rows in set (0.00 sec)

###########
# End
########## 1 2 3

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.