Re:Things in MySQL that won't work as expected
by compay on Sunday November 07, 2010 @09:12PM
(#1881101)
Most of the things listed there are not MySQL specific. Here's one that I'm pretty sure is:
SELECT * FROM example WHERE value = 'á';
where "á" uses UTF-8 encoding.
By default this will return rows that match both "á" AND "a", which may or may not be what you want.
If you want to make MySQL distinguish between an "a" with an accent and one without, then you need to specify a collation either in the table creation/alter statement, or in your query directly:
SELECT * example WHERE value = 'á' COLLATE utf8_bin;
Re:Things in MySQL that won't work as expected
by quassnoi on Monday November 08, 2010 @07:02AM
(#1882183)
All major engines have collations and collation-specific behavior (which can be confusing). However, this one I saved for the next post (with another set of completely unrelated pictures).
SELECT * FROM example WHERE value = 'á';
where "á" uses UTF-8 encoding.
By default this will return rows that match both "á" AND "a", which may or may not be what you want.
If you want to make MySQL distinguish between an "a" with an accent and one without, then you need to specify a collation either in the table creation/alter statement, or in your query directly:
SELECT * example WHERE value = 'á' COLLATE utf8_bin;