End of Summer - hours only!Up to 80% off on all courses and bundles.-Close
Introduction
CUBE
Summary

Instruction

Great! Lastly, the function COALESCE() can be used in the SELECT clause to replace NULL values with the values of your choice:

SELECT
  COALESCE(location, '--') AS location,
  COALESCE(gender, '--') AS gender,
  COALESCE(risk, '--') AS risk,
  AVG(age) AS avg_age
FROM vaccine_administration
GROUP BY 
  CUBE (location, gender, risk);

In the query above, '--' will be shown when location, gender, or risk is NULL.

Exercise

Run the template query and note how NULLs are replaced with '--'.