Operations wants to follow each order through its life: placed, paid, and refunded if that happened. The three moments are stored in three tables, and a payment can take more than one attempt.
Return order_id, ordered_at, paid_at (the of the order's payment with ), (the order's earliest refund), (from to ), and (from to ), both in days rounded to 2 decimals, for placed from 2024-11-01 through 2024-11-07 ( on or after '2024-11-01' and before '2024-11-08'). A milestone the order has not reached is NULL, and so is its lag. The result has one row per order. Order by , then .
paid_atpayment_statussucceededrefunded_atdays_to_paymentordered_atpaid_atdays_to_refundpaid_atrefunded_atordersordered_atordered_atorder_idCreate a free account to save your progress and reveal the worked answer for this free exercise. The complete practice library is available with Practice Pass or Mastery.