Deals Of The Week - hours only!Up to 80% off on all courses and bundles.-Close
Comparisons with NULL
Functions with NULL
COALESCE to the rescue
19. COALESCE with more than two parameters
Review and practice


Good job. The last thing you should know about COALESCE is that it can take more than two arguments. It will simply look for the first non-NULL value in the list and return it.

COALESCE(name, CAST(id AS varchar), 'n/a')

The above function will try to show the name of a given product. If the name is unknown, it will try to show its id instead. If the id is unknown too, it will simply show 'n/a'.


Show the name of each product together with its type. When the type is unknown, show the category. When the category is missing too, show 'No clue what that is'. Name the column type.