This is not working for me, using Toad for MySQL. I'm using MySQL 5.5 from XAMPP 1.83 on Windows.
I have a table with column InstitutionState defined as VARCHAR(20). Some rows appear to have this column "empty", meaning LENGTH(InstitutionState) = 0.
If I SELECT ... WHERE InstitutionState IS NULL, I get no rows.
If I SELECT ... WHERE InstitutionState = '', It works. Why is this?
Here's sample data.
mysql> select InstitutionState, ISNULL(InstitutionState), length(InstitutionState)
-> from institution;
+----------------------+--------------------------+--------------------------+
| InstitutionState | ISNULL(InstitutionState) | length(InstitutionState) |
+----------------------+--------------------------+--------------------------+
| NY | 0 | 2 |
| NY | 0 | 2 |
| NY | 0 | 2 |
| IL | 0 | 2 |
| NC | 0 | 2 |
| TX | 0 | 2 |
| DC | 0 | 2 |
| NY | 0 | 2 |
| CA | 0 | 2 |
| | 0 | 0 |
| KS | 0 | 2 |
| | 0 | 0 |
| NY | 0 | 2 |
| ND | 0 | 2 |
| PA | 0 | 2 |
| WI | 0 | 2 |
| PA | 0 | 2 |
| MD | 0 | 2 |
| IN | 0 | 2 |
| PA | 0 | 2 |
| NE | 0 | 2 |
| ID | 0 | 2 |
| CA | 0 | 2 |
| | 0 | 0 |
| FL | 0 | 2 |
| MO | 0 | 2 |
| | 0 | 0 |
| OH | 0 | 2 |
| IL | 0 | 2 |
| OH | 0 | 2 |
NULLis not the same as''!