Deals Of The Week - hours only!Up to 80% off on all courses and bundles.-Close
Introduction
Simple CASE WHEN
Searched CASE WHEN
12. Searched CASE WHEN – additional practice
CASE WHEN with aggregates
CASE WHEN with GROUP BY
Summary

Instruction

Ok, let's do a more sophisticated example of CASE WHEN.

Exercise

The courses have different requirements, so let's check who can actually become a student of Ethical Hacking (id = 3). Show the name of this course, the first_name and last_name of the candidate who applied for this course, and another column called qualification. The rules are as follows:

  • If the student got above 80 in math, show 'qualified'.
  • If the score in math is above 70, but the score in language is above 50, show 'qualified' as well.
  • If the score in math is between 50 and 70, show 'possible'.
  • Otherwise, show 'rejected'.

Stuck? Here's a hint!

Join three tables, pick the id = 3 in the WHERE clause and include a CASE WHEN statement.