CASE, if-then inside a query
Turn values into labels with CASE WHEN, see why the order of the WHENs matters, and count passes and retakes per subject with SUM(CASE ...).
- The skill
- Turn values into labels and count rows by category inside one query.
- You make
- Merit, pass and retake reports for a school's exam results.
Premium lesson
£7.99 a month or £59 a year. Cancel any time.
Builds on 10 GROUP BY and HAVING. Free to try: SQL Foundations and the playground.
Passed
You can now
Keep going
Step 1 of 8
exercise_1.sql
You've reached the good stuff.
5 exercises in this lesson, checked as you type. Premium opens every lesson after Foundations, in all four courses.
SQLite