July 2010
Intermediate to advanced
840 pages
16h 33m
English
A NULL might not be a value, but it does exist in SQL. This is often a problem for a new SQL programmer who is having trouble with NULLs and how they behave.
Think of them as being like a brown paper bag—you know that something is inside because you lifted it, but you do not know exactly what that something is. For example, we want to find all the employees who were not born on the same day as a famous person. This can be answered with the negation of the original query, like this:
SELECT P1.emp_name, ' was born on a day without a famous person!'
FROM Personnel AS P1
WHERE NOT EXISTS
(SELECT *
FROM Celebrities AS C1
WHERE P1.birthday = C1.birthday);But assume that among the celebrities we have a movie star who will not ...
Read now
Unlock full access