Conditional Aggregation SQL interview questions

SUM(CASE WHEN ... THEN 1 ELSE 0 END) computes several rates in one pass. It is the standard way to build cancellation rates, status pivots and percentage-of-total columns.