Ramazan Cesur Ramazan Cesur - 11 months ago 42
SQL Question

How to search for the exact string value in MySQL?

I got this code:

select * from locality WHERE name ="ISTASYON"

This works perfectly with mySQL. The problem comes, when I try to execute but result is incorrect

Result code:

28BAF9346A41E4E4E0501AAC4524363B 0 iSTASYON
402881a4523b52d201523b6c2afb4166 0 İSTASYON
402881a4523b52d201523b6c38b7417c 0 İSTASYON
402881a4523b52d201523baa9faf0092 0 İSTASYON
402881a4523b52d201523baab059009f 0 İSTASYON
402881a4523b52d201523baad01a00b7 0 İSTASYON
58441bc4c054447ebe1cddbfeef958b5 0 ISTASYON
fa7fb88d1d4c41feb497b08f42066c82 1 2016-04-19 09:53:41.000000 İSTASYON

My problem is that results contain ISTASYON, İSTASYON, ıSTASYON, iSTASYON but i wanna only ISTASYON

How to solve this problem ?

Answer Source

You can use the COLLATE or BINARY operator to force binary comparison:

SELECT * FROM locality WHERE name COLLATE utf8_bin = "ISTASYON"



If you want the column always to be treated in this fashion, declare it with a binary collation.
See the docs for more info.