How to Recognize the Antipattern
If you find yourself or another member of your team describing issues like the following, it could be because of improper handling of nulls:
-
“How do I find rows where no value has been set in the assigned_to (or other) column?”
You can’t use the equality operator for null. We’ll see how to use the IS NULL predicate later in this chapter.
-
“The full names of some users appear blank in the application presentation, but I can see them in the database.”
The problem might be that you’re concatenating strings with null, which produces null.
-
“The report of total hours spent working on this project includes only a few of the bugs that we completed! Only those for which we assigned a priority are included.” ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access