AnalystPath

Next-Day Order Confirmations

SQLEasyJunior level~15 min

Problem

A retailer stores orders in orders(order_ref, customer_id, placed_at) and follow-up phone calls in callbacks(callback_ref, order_ref, outcome, called_at). Find the customer_id of every customer whose order was confirmed exactly one calendar day after it was placed: the matching callback must have outcome 'Confirmed' and its call date must be exactly one day after the order's placement date. Order the result by customer_id ascending.

Tables

Example rows — the live problem includes the full dataset.

orders
order_refcustomer_idplaced_at
12563122024-06-14 09:30:00
43364772024-07-09 08:15:00
23461902024-08-20 10:00:00
callbacks
callback_reforder_refoutcomecalled_at
1125Confirmed2024-06-15 08:30:00
2433Declined2024-07-10 10:45:00
4234Confirmed2024-08-21 09:30:00

Expected output

Your answer should return 2 rows with the columns customer_id.

Starter code (SQL)

SELECT *
FROM orders;

Solve this SQL question free

Write SQL and run it instantly in your browser — even on your phone. No signup needed to try.

Solution & explanation

Create a free account to unlock the optimal solution, a step-by-step explanation, and the hidden test cases that grade your answer.

Sign up free to unlock

Related SQL questions