Make a Case-Sensitive Query
SELECT * FROM `table` WHERE BINARY `column` = 'value'
BINARY is a built-in keyword that after your WHERE clause that forces a comparison for an exact case-sensitive match. The BINARY operator casts the string following it to a binary string. This is an easy way to force a comparison to be done byte by byte rather than character by character. BINARY also causes trailing spaces to be significant.
As a side note, you can also make columns case-sensitive by adding the BINARY keyword when you create your table.
No comments:
Post a Comment