The following:
select * from people where first_name in ('John', 'Jim');
will bring all people that have first_name like
- John
- john
- jIm
- JIM
and all sorts of such combinations because the query is run in case insensitive mode.
How can I make this run in case sensitive mode?
I tried:
select * from people where first_name in binary ('John', 'Jim');
but it does not work.
Please, do not tell me to change the collation of the column. I want to have this dynamically, depending on user’s choice (to query case sensitively or case insensitively).
Anything?
The idea with
binaryis good, but you to apply it to the column name instead of the search terms. This way, the index will not be used. However, you can use a combination: