Select... Like %... % To find
MySQLThe text field is a Chinese character, but it is found that it is messy, and many people have encountered such problems.
When sorting and searching Chinese characters, the results of Chinese characters are incorrect.
The reason is that MySQL is case insensitive when looking for strings, and the character set uses ISO-8859 by default, problems may occur during conversion.
There are two solutions:
The first method is to useBinaryKeyword.
The binary operator enforces the string following it as a binary string. This can easily force the comparison of a column to be case-sensitive even if the column is not defined as binary or blob.
OriginalSQLThe statement is as follows:
Select ID, Chinese from app_name_content where Chinese like '% ze %' limit 1;
The current statement is:
Select ID, Chinese from app_name_content where Chinese like
Binary'% Ze %' limit 1;
The second method changes the field type to binary. You can also use the like statement.
In this way, you can find it accurately.