I was working on a WordPress database problem and run across an interesting problem that was difficult to fix. One of those situations where assumptions of the user are not the same as those of the programmer.
Unfortunately, these types of problems exist EVERYWHERE in the software engineering profession. It’s probably one of the reasons why assembling a really good software team can be so difficult.
What I’d found was that a specific number was not entered, resulting in specific information NOT being displayed… which is different than what would have been displayed if the number were 0, 1 or any other number. In other words, something other than NULL. In other words, “The empty set.”
Which leads to the following question:
What is the difference between 0 and NULL? The answer is actually, quite a lot.
Zero is a specific number, NULL is the lack of any number. For example, your WordPress database table might have some numeric values where NULL is allowed. A NULL value just means that no data has been entered for that field. It is the empty set.
The difference is that 0 is a numeric value where NULL is not. A database entry can have a “0” in it, but it can also be empty. NULL is still a value, but mathematicians and software engineers have deemed it special.
For those of you who like being particular, the empty set may also be called the void set. It is commonly denoted by the symbols , or .