RienSQL
TASK #156 · Medium · Zalando

Monthly Average Product Rating

Your brief
Zalando collects customer product reviews: each row in reviews is a stars rating (1 to 5) left by user_id for product_id on submit_date.

Write a query that for every (product, month) pair returns product_id, the month number mth, and the average rating avg_stars rounded to two decimals. Only consider products that have at least one review.
Expected columnsproduct_id mth avg_starsZalando
SQL editor
SQLite
Ctrl / ⌘ + ↵
Result

Write a query and run it to see the results.

Schema
productsproduct_id, product_name, category, price
reviewsreview_id, product_id, user_id, submit_date, stars
inventoryinventory_id, product_id, status, add_date
ordersorder_id, user_id, order_date
order_itemsitem_id, order_id, product_id, quantity