Instruction
Great! The use of CASE WHEN together with SUM is actually so important that we should do one more exercise here. Are you ready?
Exercise
Count the number of candidates with preferred_contact set to:
- 'mobile' (
mobile_sum). - 'e-mail' (
email_sum). - 'mail' (
mail_sum). - with
NULL(null_sum).
Only count candidates whose score in math and score in language are both greater than or equal to 30.
Stuck? Here's a hint!
Start with:
SELECT SUM(CASE WHEN preferred_contact = 'mobile' THEN 1 ELSE 0 END) AS mobile_sum
and continue the same way.



