Flag shipments that breached their SLA
Each shipment has an agreed delivery window (sla_days). For every shipment, compute the actual number of days it took to deliver, and flag it 'Late' if that exceeds the SLA, otherwise 'On time'.
Return tracking_no, actual_days, and status.
Schema
| id | INT |
| tracking_no | TEXT |
| dispatched_at | TIMESTAMP |
| delivered_at | TIMESTAMP |
| sla_days | INT |
Example input
Stuck? Ask the coach for a nudge that won't give the answer away, or reveal the reference solution and a short walkthrough of why it works.
The interviewer's next question
Instead of a Late/On time flag, show by how many days each shipment breached its SLA — 0 for anything on time or early. Return tracking_no and days_over.
Solving follow-ups — the questions an interviewer actually asks next — unlocks with a Basic plan.
See Basic plansRM 25/mo · cancel anytime
For a variance report, show each shipment's days_variance: actual days minus SLA days, as a signed number (negative means it beat the SLA, positive means it breached it).
Solving follow-ups — the questions an interviewer actually asks next — unlocks with a Basic plan.
See Basic plansRM 25/mo · cancel anytime