Skip to main content

E-commerce: Total Orders by Category

MediumPremium

Amazon is a large e-commerce platform where customers can order various items ranging from electronics to clothing.

You're provided with two tables, orders and items, with the following columns:

order_idcustomer_idorder_dateitem_idorder_quantity
integerintegerdateintegerinteger
item_iditem_category
integerstring

Write an SQL query to find how many units were ordered in each category in the last 7 days, for each day of the week. Sort alphabetically by item_category.

Desired output example:

item_categoryorder_datetotal_units_ordered
Books2023-09-264
Books2023-09-285
Clothing2023-09-277
Clothing2023-09-303
Electronics2023-09-252

This question is part of a 5-part e-commerce question series. The other lessons in the series are linked below: