1479. Sales by Day of the Week

https://leetcode.com/problems/sales-by-day-of-the-week

Description

Table: Orders


+---------------+---------+
| Column Name   | Type    |
+---------------+---------+
| order\_id      | int     |
| customer\_id   | int     |
| order\_date    | date    | 
| item\_id       | varchar |
| quantity      | int     |
+---------------+---------+
(ordered\_id, item\_id) is the primary key for this table.
This table contains information of the orders placed.
order\_date is the date when item\_id was ordered by the customer with id customer\_id.

Table: Items


+---------------------+---------+
| Column Name         | Type    |
+---------------------+---------+
| item\_id             | varchar |
| item\_name           | varchar |
| item\_category       | varchar |
+---------------------+---------+
item\_id is the primary key for this table.
item\_name is the name of the item.
item\_category is the category of the item.

You are the business owner and would like to obtain a sales report for category items and day of the week.

Write an SQL query to report how many units in each category have been ordered on each day of the week.

Return the result table ordered by category.

The query result format is in the following example:

ac

Last updated

Was this helpful?