Days Between Orders
EasyDescription
For customer 7, show order_id, order_date and, counting by order_date and then
order_id:
previous_order_date: the date of the order before this one (NULL for the first order)days_since_previous: the number of days between the two (NULL for the first order)
End your query with ORDER BY order_date, order_id.
Tables
| orders |
|---|
| order_id (PK) |
| customer_id (FK) |
| order_date |