Write a query to return every row in activity_events with minutes_since_prev and session_no within its customer. Order each customer’s events by event_at, then event_id, both ascending.
The first event starts session 1 and has a NULL previous gap. Start the next session only when the actual timestamp gap is greater than 30 minutes; exactly 30 minutes continues the same session. Restart numbering at 1 for each customer.
Show the previous gap in whole elapsed minutes, without using that truncated value to decide the boundary. Return event_at as text using strftime with '%Y-%m-%d %H:%M:%S'.
Ordering: Sort by customer, then event_at, then event_id in ascending order.