Nulls Revisited: A Cautionary Note
Now is as good a time as any to remind you about Nulls. You learned in Chapter 5 that a Null represents the absence of a value and that an expression processing a Null value will return a Null value. The same holds true for search conditions as well. A predicate that evaluates a Null value can never be true. This might seem confusing, but the predicate can never be false either! The SQL Standard defines the result of any predicate that evaluates a Null as unknown. Remember that a predicate must be true for a row to be selected, so a false or unknown result will reject the row.
To help clarify the matter, let’s reexamine in Figures 6-13 and 6-14 (page 194) the truth tables we first showed you in Figures 6-9 ...
Get SQL Queries for Mere Mortals: A Hands-On Guide to Data Manipulation in SQL, Second Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.