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

Instruction

Nice! You can also use COALESCE with other functions: concatenation, multiplication etc. Take a look:

COALESCE(category, '') || ':' || COALESCE(type, '')

In the above fragment, a NULL category or type will be replaced by an empty string. Thanks to this, we can still see the type when the category is NULL and vice versa.

Exercise

Show the following sentence: Product X is made in Y. Where X is the name and Y is the production_area. If the name is not provided, write 'unknown name' instead. If the production_area is not provided, write 'unknown area'. Name the column sentence.

Stuck? Here's a hint!

Use the concatenation symbol || to create the right sentence. Remember about the period (.) at the end of the sentence.