Save up to $499! Grab all Python courses for $49 or all online courses we’ve ever launched for only $169. Only Feb 11-16. Happy Valentine's!
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.