Your regular reminder that NULL in databases doesn't mean "an empty value", it means "I literally don't know what this value is, it could be 6 or 6000 or -23, who's to say?"

This difference is important, because "tell me all the people where wearing_hat is not true" - you might think you'll get records where wearing_hat is NULL, but you won't! They could be wearing a hat or not, NULL means you don't _know_ whether they're wearing a hat. The fact represented by wearing_hat could be true, even if the database value is NULL.

And of course, if you ask if NULL = NULL, you don't get true, you get get NULL. Is Jody's hat-wearing status the same as Olaf's? If you don't know whether either of them are wearing a hat, you can't say that their hat-wearing status is the same.

Much of this is the case for null values in various languages, but this is pretty universally true for databases, and trying to work with them without understanding this will cause you much pain!

Your regular reminder that NULL in databases doesn't mean "an empty value", it means "I literally don't know what this value is, it could be 6 or 6000 or -23, who's to say?"

This difference is important, because "tell me all the people where wearing_hat is not true" - you might think you'll get records where wearing_hat is NULL, but you won't! They could be wearing a hat or not, NULL means you don't _know_ whether they're wearing a hat. The fact represented by wearing_hat could be true, even if the...