Deals Of The Week - hours only!Up to 80% off on all courses and bundles.-Close
Comparisons with NULL
Functions with NULL
13. NULL with function length
COALESCE to the rescue
Review and practice


Correct! The last thing we want to warn you about is the function length(x), which will also return NULL when x is NULL. This is why the query:

FROM product
WHERE length(category) < 20;

will not return a row with a NULL category. Is this correct? Again, it depends on what you need.


Mr Amund wants to pick products with short names for his new advertisement. Show the names of all products shorter than 8 characters or those which have a NULL name. Show the description as the second column so that Mr Amund can think of a (short) name if it's missing for a certain product before the advertisement is published.

Stuck? Here's a hint!

In the WHERE clause, you need two conditions joined with OR. Use IS NULL in one of them.