Imagine you're comparing two MySQL columns and you want to know how many rows are different. No problem, you think:
WHERE width != height;
Not so fast. If some of the widths or heights are null, they won't be counted! Surely that wasn't your intention. That's where you need a null-aware operator like <=>:
WHERE NOT (width <=> height);
Because <=> is actually a null-aware version of the equal operator, we need to negate it with NOT. Now, your count will be "null aware" and you'll get the result you want.
Spread the word