Question: The GROUP BY Clause and the SUM Function
Explore how to write SQL queries that group data by category and calculate the total price using the SUM function. This lesson strengthens your ability to analyze grouped data and make informed decisions in scenarios like e-commerce pricing.
We'll cover the following...
We'll cover the following...
Question
Given the following Products ...
Products
ProductID | ProductName | Category | Price | UnitsSold |
1 | Smartphone | Electronics | 599.99 | 100 |
2 | Laptop | Electronics | 999.99 | 50 |
3 | Headphones | Electronics | 149.99 | 75 |
4 | T-shirt | Apparel | 19.99 | 200 |
5 | Jeans | Apparel | 39.99 | 150 |
6 | Running shoes | Footwear | 79.99 | 100 |
7 | Bagpack | Accessories | 49.99 | 80 |
...