9/1/2017 - 9:38 PM


-- NULLs - NULL means unknown, not zero or empty. Therefore, NULL = NULL returns False (it is unknown if the first unknown NULL is equal to the second unknown NULL), NULL IS NULL returns True (is unknown null unknown? yes)

-- ISNULL(), returns a specific value if a NULL is found in any row. This is useful for things like returning a 0 where a NULL is returned. Format is ISNULL(column to select, value to return if a NULL is present). In the example below, all NULLs found in the PromoPoints column will be replaced with a 0.
SELECT ISNULL(PromoPoints, 0) FROM orders1;

-- NULL(IF), returns a NULL if a certain value is found in any row. Format is NULLIF(column to select, value when found to be switched out with a NULL). In the example below, when the value 'Red' is found in the results, it'll be returned as a NULL.
SELECT NULLIF(Colors, 'Red') FROM orders1;