Back-To-School Deals - hours only!Up to 80% off on all courses and bundles.-Close
Introduction
Simple CASE WHEN
6. Simple CASE WHEN with NULLs
Searched CASE WHEN
CASE WHEN with aggregates
CASE WHEN with GROUP BY
Summary

Instruction

That's correct! Having gone through Part 5 about NULLs, you might want to ask: okay, but how do NULLs behave in CASE WHEN?

The answer is pretty straightforward: NULL will always go to the ELSE condition if you include it. Let's check this out in an exercise.

Exercise

For table candidate, show each candidate's id, preferred_contact and the third column which will print:

  • 'traditional' if the preferred_contact is 'mail'.
  • 'modern' if it's 'mobile' or 'e-mail'.
  • 'other' otherwise.

Look what is shown for NULL values.