Monthly Product Review Averages
Problem
**[Asked at Amazon]**
Amazon tracks customer star ratings (1–5) for every product. The catalogue team
wants a monthly report: for each product, what was the average rating each month?
Return `review_month` (as 'MM'), `product_id`, and `avg_stars` rounded to
**2 decimal places**. Order by month then product ID.
Tables
Example rows — the live problem includes the full dataset.
product_reviews
| review_id | user_id | product_id | stars | review_date |
|---|
Expected output
Your answer should return 6 rows with the columns review_month, product_id, avg_stars.
Starter code (SQL)
SELECT *
FROM product_reviews;Solve this SQL question free
Write SQL and run it instantly in your browser — even on your phone. No signup needed to try.
Solution & explanation
Create a free account to unlock the optimal solution, a step-by-step explanation, and the hidden test cases that grade your answer.
Sign up free to unlock