SELECT * FROM Customers
WHERE City IN ('Paris','London');
How would I change it to match exact case (basically exact match)? i.e. lOnDoN
would not be included in the results.
Use BINARY
to force a binary (byte for byte) string comparison:
SELECT * FROM Customers
WHERE BINARY City IN ('Paris','London');
Or, if you always want the City
column to be case sensitive, consider altering the collation of the column.
Not sure if BINARY
would work with IN
, like this:
SELECT * FROM Customers
WHERE BINARY City IN ('Paris','London')
You can use BINARY
SELECT *
FROM Customers
WHERE BINARY City IN ('Paris','London')
BINARY Work like below.
mysql> SELECT 'a' = 'A';
-> 1
mysql> SELECT BINARY 'a' = 'A';
-> 0
mysql> SELECT 'a' = 'a ';
-> 1
mysql> SELECT BINARY 'a' = 'a ';
-> 0
Please find more info on BINARY