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

Instruction

Excellent! Let's do one more exercise of this kind.

Exercise

For each candidate, with at least one application, show their id and three more columns called count_accepted, count_rejected, count_pending. Each of these columns should count the number of times the candidate has been accepted to courses, rejected or where the decision is pending.

Sort the rows in ASCending order by the id.

Stuck? Here's a hint!

The first SUM will look like this:

SUM(CASE WHEN status = 'accepted' THEN 1 ELSE 0 END) AS count_accepted