Chapter 4 · Aggregations
54. Product Statistics per Category
Medium20 XPE-Commerce
The product team wants a statistical overview by category. For each category_id, show the number of products, the minimum price, maximum price, and average price (rounded to 2 decimals). Sort by the number of products descending.
Tables
- PKidINT
- nameTEXT
- FKcategory_id→ categories.idINT
- priceREAL
- costREAL
- stock_quantityINT
- created_atTIMESTAMP
Need help?
Ask Sol
AI tutor — looks at your current query and nudges you, without spoiling the answer.
Solution
Try the hints first — solving it yourself is what makes it stick.