Rainbow Deals - hours only!Up to 80% off on all courses and bundles.-Close
GROUP BY – Recap
4. Grouping by a single column


To quickly recap what you already know about grouping rows in SQL, here is a simple problem: suppose we want to know the average score for each TV show contestant over the course of five weeks. In SQL, we'd write the following query:

 AVG(Score) AS AvgScore
FROM ContestScore
GROUP BY FullName;

In this simple query, we grouped the results by a single column (FullName) and used the AVG() function to calculate the average score for each contestant. Nothing really difficult.


How much, in total, was spent on deliveries for each Category? Show two columns: Category and the sum of TotalPrice (as Total).

Stuck? Here's a hint!

Simply GROUP BY Category.