Introduction
GROUP BY – Recap
4. Grouping by a single column
Summary

Instruction

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:

SELECT
 FullName,
 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.

Exercise

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.