Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MariaDB / MySQL querys are case sensitive?

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!

like image 555
Ommadawn Avatar asked Oct 26 '25 19:10

Ommadawn


1 Answers

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.

like image 88
stdunbar Avatar answered Oct 29 '25 07:10

stdunbar



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!