TASK #158 · Medium · ZalandoInventory State Breakdown
Your brief
The inventory table stores the current status of every
physical unit: Sold, Available, or Returned.
Write a query that for every product in products returns product_name and three counters: units_sold, units_available, units_returned. Products that have no inventory units yet must also appear in the output with zeros in the corresponding columns.
Write a query that for every product in products returns product_name and three counters: units_sold, units_available, units_returned. Products that have no inventory units yet must also appear in the output with zeros in the corresponding columns.
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