Chapter 4 · Aggregations
48. Average Rating Per Product
Medium20 XPE-Commerce
The product team wants to find well-reviewed products. Calculate the average rating for each product that has at least 3 reviews. Return the product_id, average rating (rounded to 1 decimal), and review count, sorted by average rating descending.
Tables
- PKidINT
- FKproduct_id→ products.idINT
- FKcustomer_id→ customers.idINT
- ratingINT
- commentTEXT
- review_dateTEXT
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.