3 ms·
Philosophically that makes sense.. but in practice I honestly don't recall a time that I've found NULLs being incomparable to be useful. It's always been the ca
by rowanseymour 7y ago
Philosophically that makes sense.. but in practice I honestly don't recall a time that I've found NULLs being incomparable to be useful. It's always been the case that I want NULL to match NULL.
- SigmundA 7y agoExactly, NULL != NULL is surprising since pretty much every other language treats them equal and seems to serve no purpose other than being philosophically "right". Even SQL databases that adhere to ANSI NULLS must treat NULL==NULL sometimes (group by, order by) Obviously you need to compare nulls hence the crazy IS NOT DISTINCT FROM which is just another way of saying "equal" in English.
- derefr 7y agoIf you GROUP BY some column, do you want the rows where the column is NULL to get grouped together? They're probably all distinct things. For example, if your items represent tags, and you're grouping by parent_id to find subtags, the ones without parents (parent_id IS NULL) aren't all subtags of some root of a tag tree; they're all distinct root tags in a tag forest.