
Weekend orders
mediumWeekend orders
Walmart SQL Interview Question
Walmart's delivery team is deciding whether to add weekend delivery shifts and wants to review the orders placed on weekends.
List the order_id and order_date of every order placed on a Saturday or a Sunday.
Asked of
- Data Analyst
- Product Analyst
- Data Scientist
- Analytics Engineer
- Data Engineer
ordersTable35 rows
| Column Name | Type |
|---|---|
| order_id | BIGINT |
| customer_id | BIGINT |
| order_date | DATE |
| status | VARCHAR |
| amount | DOUBLE |
ordersExample Input
| order_id | customer_id | order_date | status | amount |
|---|---|---|---|---|
| 1011 | 4 | 2024-02-14 | completed | 480 |
| 1012 | 7 | 2024-02-18 | completed | 295.3 |
| 1013 | 2 | 2024-02-21 | completed | 1975 |
| 1014 | 5 | 2024-02-25 | completed | 2890.5 |
| 1015 | 1 | 2024-03-01 | completed | 210 |
| 1016 | 8 | 2024-03-04 | completed | 4100 |
| 1017 | 6 | 2024-03-08 | canceled | 62 |
| 1018 | 3 | 2024-03-12 | completed | 178.25 |
| 1019 | 7 | 2024-03-16 | completed | 340.8 |
| 1020 | 4 | 2024-03-19 | completed | 525 |
Example Output
| order_id | order_date |
|---|---|
| 1012 | 2024-02-18 |
| 1014 | 2024-02-25 |
| 1019 | 2024-03-16 |
Explanation
February 18 and February 25, 2024, were Sundays, and March 16 was a Saturday, so orders 1012, 1014 and 1019 are returned. Order 1015 was placed on Friday, March 1, so it is left out.
The example above is a small slice of the data. Your query runs against the full tables.
Company
Walmart
Difficulty
medium
Topic
dates
Your query
Starting the SQL engine...