Menu▾

Topic

Aggregation

GROUP BY, HAVING and conditional aggregates. The recurring skill is filtering at the right stage — WHERE before grouping, HAVING after — and knowing why COUNT(*) and COUNT(column) disagree.

New to this? Read the Aggregate functions: SUM, AVG, COUNT, MIN, MAX chapter.

easyAverage balance by account typeBasic→easyCompleted rides by cityFree→easyOrders by statusFree→mediumAd click-through conversion rate, per campaignBasic→mediumDefect rate per production lineBasic→mediumPivot quarterly sales into columnsBasic→mediumSplit mudarabah profit across depositors by weighted balanceFree→mediumTop 3 restaurants by ordersBasic→mediumUtilisation rate per consultantFree→hardPivot payment channels into columns, per merchantBasic→