RIGHT JOIN
between the Orders
and Items
tables on the item_id
column to include all categories, even those without orders.WEEKDAY
function to determine the day of the week for each order_date
.SUM
function with a CASE
statement inside to conditionally sum the quantity
for each day of the week.item_category
.item_category
.item_category
and the conditional sums for each day of the week as the final output.erDiagram Orders { int order_id int customer_id date order_date varchar item_id int quantity } Items { varchar item_id varchar item_name varchar item_category } Orders }|--|| Items : ""