Amazon logistics monitors on-time delivery guarantees. Write a SQL query to find all orders delivered after their promised date. For each late order, report `order_id`, `customer_id`, `promised_date`, `delivered_date`, and `days_late` (calculated as delivery date minus promised date). Exclude orders that have not yet been delivered (`delivered_date` is NULL). Sort the results by `days_late` descending, then by `order_id` ascending.
Loading…
Try solving the question with the schema explorer and hints first. When ready, reveal the verified canonical query and step-by-step logic breakdown.
Ask questions, share alternate queries, and explore solutions
Your recent query executions and answer checks
This will insert the verified MySQL solution into your editor so you can study how each clause transforms the table.