Usually, data storage needs to specify the case sensitivity of string fields. MySQL Default queries are not case sensitive. However, as user information, once the user name is repeated, it will waste a lot of resources. In addition, it is difficult to identify the problems caused by the increase of Li Xiao and Li GUI. To do this, either when creating a table, it is case-sensitive (the field is case-sensitive ). If all fields in the overall database need to be case sensitive, it is better to adjust the character set settings. However, this is generally not recommended.
If, like me, the database has been running online and a table contains millions of data records, changing the field type may cause the database to go down. Well, it's better to add more words during the query!
For example, general query:
SELECT * FROM 'user' WHERE name LIKE 'a % ';
The results are the same. to distinguish between 'a % 'and 'a %', you can do this:
SELECT * FROM 'user' WHERE binary name LIKE 'a % ';
You can get different results if you only have one binary file!
Of course, you can write this statement if you need to make the table case sensitive:
Create table 'user' (name varchar (20) binary );