Average product rating by month
Amazon is analyzing month-by-month changes in product ratings. For each month and product_id pair, calculate the average product rating. Round it to two decimal places and return it in the avg_stars column. Also return mth — the month number — and product_id. Sort the result by mth, then by product_id.
Expected output sample
This is what a correct answer looks like — its row count is its own, it doesn't have to match the schema tables.
| mth | avg_stars | product_id |
|---|---|---|
| 1 | 3.50 | 101 |
| 1 | 4.00 | 103 |
| 2 | 4.00 | 101 |
Amazon
Sign in to see submission history
Sign inSign in to use AI Mentor
Sign inFocus radio
Paused · SomaFM · Fluid