Why does this SQL CHAR comparison match wrong with trailing spaces?

Why does this SQL CHAR comparison match wrong with trailing spaces. The SQL code uses CHAR which pads with spaces. In MySQL 'a' and 'a ' compare equal. In SQL lookups you can match the wrong row.

#whatswrongwiththissqlquery #sqlbug #sqlproductionbug #sqldebugging #sqldatabase #sqlcodereview #sqlperformance #sqlreliability #sqlanalytics #sqldataintegrity #sqlengineering #sqlchar ...

https://www.youtube.com/watch?v=CyfztMPBd5o

Why does this SQL CHAR comparison match wrong with trailing spaces? #sqlreliability

YouTube