MichaelB.
7/28/2018 - 12:44 PM

Use NULL and NOT NULL

Question mark values are null values. Null values are just unknown values to the DBMS. The DBMS does not understand what those values are. A null value is not equal to a numeric 0 or an empty string, blank / space character. An empty value will just be blank. If you use a WHERE clause without = NULL the null values are removed from the result set. When you use NULL the equal comparison operator will not work. You need to use IS NULL. NOT negates what you're trying to do. Use NOT NULL to exclude the null values.

SELECT column(s) 
FROM table
WHERE column IS NULL;


-- Filter on non-null values
SELECT column(s) 
FROM table
WHERE column IS NOT NULL;