Write a query to return every page_view row in events with the same user’s next checkout in event order. Order each user’s events by event_ts, then event_id, both ascending.
Return the first checkout later in that sequence as next_checkout_ts, and the whole elapsed minutes to it as minutes_to_checkout. A checkout at the same timestamp with a larger event ID qualifies with a gap of 0. If no later checkout exists, return NULL for both values.
Return event_ts and next_checkout_ts as text using strftime with '%Y-%m-%d %H:%M:%S'. Include all page views, and no other event types.
Ordering: Sort by user_id, then event_ts, then event_id in ascending order.