The following article mainly introduces Mysql case-sensitive solution to some of the problems, this article is through Mysql sensitivity to its detailed study, the following is the article on the specific content of a detailed introduction, hope you browse after Mysql case-related issues have a better understanding.
1, database and table name
In Mysql, the database and table correspond to the directories and files in those directories, so the inherent operating system sensitivity determines the case sensitivity of the database and table naming. This means that database and table names are case-sensitive on Unix and case-insensitive on Win32.
Note: On Win32, you should not reference a given database or table in a different case in the same query, even though the database and table names ignore Mysql case. The following query will not work because it references a table as my_table and as MY_TABLE:
1.Mysql> SELECT * FROM my_table WHERE MY_TABLE.col = 1;
2, the column name
Column names are case-insensitive in all cases.
3, the table's alias
The alias of the table is case sensitive. The following query will not work:: Because it references aliases with a and A:
1.Mysql> SELECT col_name FROM tbl_name AS a
2. WHERE a.col_name = 1 OR A.col_name = 2;
4, column alias
Alias column is ignored case.
5, string comparison and pattern matching
By default, Mysql searches are case insensitive (although there are some character sets that never ignore Mysql, such as Czech). This means that if you search with col_name LIKE a% you will get all the column values starting with A or a. If you want to make the search case sensitive, check for a prefix like INDEX (col_name, "A") = 0. Or STRCMP (col_name, "A") = 0 if the column value must be exactly "A".
Simple comparison operations (> =,>, =, <, <=, sorting, and aggregation) are based on the "sorted value" of each character. Characters that have the same ordering value (like E, e) are treated as the same character!
The LIKE comparison is performed on the uppercase value of each character ("E" = "e").
If you want a column to always be treated as a case-sensitive Mysql, declare it BINARY.
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.