lag
lag(x) reads x from the previous row of the window; the first row gets NULL.
task
Days since the customer's previous order, for each order: columns order_id and the day difference (NULL for the first order). Dates are placed_at cast to date.
Run a query to see rows here.
Run EXPLAIN on the statement under the cursor: Plan tab, button Explain.
No tables yet.
lag(x) reads x from the previous row of the window; the first row gets NULL.
Days since the customer's previous order, for each order: columns order_id and the day difference (NULL for the first order). Dates are placed_at cast to date.