Some while ago, I\'ve been reading through the book SQL and Relational Theory by C. J. Date. The author is well-known for criticising SQL\'s three-valued logic (3VL).
You can eliminate null
in the output as well by using COALESCE.
SELECT personid /*primary key, will never be null here*/
, COALESCE(name, 'no name') as name
, COALESCE(birthdate,'no date') as birthdate
FROM people
Not all databases support COALESCE, but almost all have a fallback option called
IFNULL(arg1, arg2)
or something simular that will do the same (but only for 2 arguments).