Weekend orders

dates

Weekend 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 NameType
order_idBIGINT
customer_idBIGINT
order_dateDATE
statusVARCHAR
amountDOUBLE

ordersExample Input

order_idcustomer_idorder_datestatusamount
101142024-02-14completed480
101272024-02-18completed295.3
101322024-02-21completed1975
101452024-02-25completed2890.5
101512024-03-01completed210
101682024-03-04completed4100
101762024-03-08canceled62
101832024-03-12completed178.25
101972024-03-16completed340.8
102042024-03-19completed525

Example Output

order_idorder_date
10122024-02-18
10142024-02-25
10192024-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.