Essentially all truly general purpose database systems today are based on the relational model of data. That model was invented by E. F. ("Ted") Codd in the late 1960s and early 1970s, during his employment at the IBM Research Laboratory in San Jose, California, and it was solidly based on conventional two-valued logic, 2VL. Unfortunately, those same general purpose database systems today all use the language SQL as their user language-and SQL is based not on 2VL but on what’s called three-valued logic, 3VL, instead, and uses what are called nulls to represent missing information. In fact, Codd himself subsequently extended his original model to support 3VL and nulls as well. (Actually, basing SQL on 3VL and adding 3VL to the relational model seem to have occurred in lockstep, as it were. Certainly both developments occurred at the same place-the IBM San Jose Research Laboratory-at more or less the same time.)
But 3VL is a disastrously bad basis on which to build databases, or database applications, or database languages.It’s bad because 3VL doesn’t behave the way reality behaves, which means that results that 3VL says are correct are often not correct in the real world. Not only that, but SQL’s implementation of 3VL is itself incorrect in places, which means it effectively adds another layer of wrong answers on top of the first. Bottom line:
If you have nulls in your database, you’re getting wrong answers.
This book explains this issue in detail. It also contains numerous practical suggestions for dealing with the problem.