Advancedhow it works
Split user events into sessions with a 30-minute inactivity gap.
Quick answerFree
Use LAG(event_time) OVER (PARTITION BY user_id ORDER BY event_time) to get the previous event. Flag a new session when there is no previous event or the gap is more than 30 minutes.
Detailed answer· 69 words
ProUnlock the full answer with Pro
Get a 69-word model answer, 3 key points and a visual explainer, plus 307 more SQL questions.
Key points· 3 points
ProUnlock with Pro
Visual explainer· animated, step by step
ProUnlock with Pro
+ 307 more SQL questions in Pro, each with the full answer.