TASK #159 · Hard · ZalandoTop Category by Monthly Revenue
Your brief
Line-item revenue is order_items.quantity × products.price;
the month comes from orders.order_date.
Write a query that for every month returns mth (in the 'YYYY-MM' format) and the category with the highest total revenue in that month. Test data excludes the case of two categories with equal revenue. Sort the result by mth.
Write a query that for every month returns mth (in the 'YYYY-MM' format) and the category with the highest total revenue in that month. Test data excludes the case of two categories with equal revenue. Sort the result by mth.
Ctrl / ⌘ + ↵
Result
Write a query and run it to see the results.
Schema
productsproduct_id, product_name, category, pricereviewsreview_id, product_id, user_id, submit_date, starsinventoryinventory_id, product_id, status, add_dateordersorder_id, user_id, order_dateorder_itemsitem_id, order_id, product_id, quantity