Note that MySQL is not using the expression alias in a `WHERE` clause, but just the original column value. Confusion might arise due to the use of the `TRIM` function and the way MySQL string collations trim trailing spaces. Refer to [this documentation](https://dev.mysql.com/doc/refman/5.6/en/charset-binary-collations.html#charset-binary-collations-trailing-space-comparisons) for MySQL 5.6: >## Trailing Space Handling in Comparisons >Nonbinary strings have PAD SPACE behavior for all collations, including _bin collations. Trailing spaces are insignificant in comparisons: > >``` >mysql> SET NAMES utf8 COLLATE utf8_bin; >mysql> SELECT 'a ' = 'a'; >+------------+ >| 'a ' = 'a' | >+------------+ >| 1 | >+------------+ >``` > >For binary strings, all bytes are significant in comparisons, including trailing spaces: > >``` >mysql> SET NAMES binary; >mysql> SELECT 'a ' = 'a'; >+------------+ >| 'a ' = 'a' | >+------------+ >| 0 | >+------------+ >```