Skip to main content
Admissions guidance, study banks, and career tools โ€” get started on Shalyam

Sessionize Events (30 Minute Gap)

A new session starts when a user's gap since their previous event exceeds 30 minutes. Return user_id and the number of sessions per user, ordered by user_id.

Table schema

Events(user_id INT, event_time TIMESTAMP)

Sample data

user_id | event_time
1 | 2026-05-01 10:00:00
1 | 2026-05-01 10:20:00
1 | 2026-05-01 11:30:00
2 | 2026-05-01 09:00:00

Discussion

No discussions yet.

Rewards ยท v2.1

Join Shalyam Newsletter

Get exclusive insights with every issue: education, research and innovation news.

One email a week. Unsubscribe any time.