I just want to know if that querys are case sensitive or not. Are the same these querys?
SELECT * FROM Users WHERE login="john";
SELECT * FROM Users WHERE login="John";
SELECT * FROM Users WHERE login="JOHN";
SELECT * FROM Users WHERE login="jOHn";
I have tried that on my console and all of them worked, but I want to be sure of that if I would use Hibernate or anything else.
Thanks!
According to the MySQL docs ,
The default character set and collation are latin1 and latin1_swedish_ci, so nonbinary string comparisons are case insensitive by default
As to the second part of you question - this SO answer shows you how to configure to have the searchers be case sensitive.
Just an example from my Linux ( Debian 10 ) Box in MariaDB (Ver.10.3.18-MariaDB-0+deb10u1 ).May be helpful for someone !!
MariaDB [niffdb]> select * from account_heads where head_desc="Fuel";
+---------+-----------+
| head_id | head_desc |
+---------+-----------+
| 1 | Fuel |
+---------+-----------+
1 row in set (0.004 sec)
MariaDB [niffdb]> select * from account_heads where head_desc="FUEL";
+---------+-----------+
| head_id | head_desc |
+---------+-----------+
| 1 | Fuel |
+---------+-----------+
1 row in set (0.001 sec)
MariaDB [niffdb]> select * from account_heads where head_desc="fUEL";
+---------+-----------+
| head_id | head_desc |
+---------+-----------+
| 1 | Fuel |
+---------+-----------+
1 row in set (0.001 sec)
MariaDB [niffdb]>
From MariaDB docs , it depends on OS. For Windows, it's not case-sensitive. For Linux, Database, table, table aliases and trigger names are affected by the systems case-sensitivity, while index, column, column aliases, stored routine and event names are never case sensitive.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.