Introduction
A retail store manager needs help analyzing their sales data to make inventory decisions. As a database analyst, you need to help them calculate some key metrics using MySQL aggregate functions and grouping operations.
A retail store manager needs help analyzing their sales data to make inventory decisions. As a database analyst, you need to help them calculate some key metrics using MySQL aggregate functions and grouping operations.
The store manager needs a summary report showing the performance of each product category. The report should include the total number of items sold and total revenue for each category.
retail_store databasecategory_sales.txt in the ~/project directory~/project directorycategory_sales.txt in the ~/project directoryAfter writing the correct query and saving the results, you can verify the output:
cat ~/project/category_sales.txt
+-------------+-------------+---------------+
| category | total_units | total_revenue |
+-------------+-------------+---------------+
| Electronics | 35 | 13174.65 |
| Furniture | 23 | 3519.77 |
| Appliances | 10 | 799.90 |
+-------------+-------------+---------------+
In this challenge, you practiced using MySQL aggregate functions and the GROUP BY clause to analyze sales data. The skills demonstrated include calculating sum totals, using arithmetic operations in SQL queries, grouping data by category, and ordering results. These fundamental SQL skills are essential for generating business reports and analyzing sales performance metrics.