Revision
Comparisons with NULL
Functions with NULL
COALESCE to the rescue
16. Conversion for COALESCE
NULLIF
Revision and practice

Instruction

Good. COALESCE failed, as you can see. How can we cope with it? We can always convert any type to varchar:

COALESCE(CAST(price AS varchar),'--');

Let's give it a go.

Exercise

Second time lucky! Modify the template to select the product name and launch_date. Show 'no date' when there is no launch_date. Add CAST so that COALESCE works properly.

Stuck? Here's a hint!

Use COALESCE(CAST(launch_date AS varchar), 'no date').

Console

Code editor

Result

TableConsole