Average product rating by month
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. Your answer must use the same column names as this sample — alias them with AS if needed.
| mth | product_id | avg_stars |
|---|---|---|
| 1 | 101 | 3.50 |
| 1 | 103 | 4.00 |
| 2 | 101 | 4.00 |
Amazon
Sign in to see submission history
Sign inSign in to use AI Mentor
Sign inFocus radio
Paused · SomaFM · Fluid