You're an analyst at FreshCart, an online hypermarket. The marketing team is preparing to calculate conversion rates per session. First, identify where each customer's sessions begin and end in the sequence of page views. A new session begins only when strictly more than 30 minutes have passed since that customer's previous page view. A gap of exactly 30 minutes is still part of the same session. Each customer's first page view always starts a new session.
Assign a session-start flag to every page view in page_views.
Return these columns:
- customer_id — customer ID;
- viewed_at — page view timestamp (as stored in the table);
- is_new_session — boolean: true if this page view starts a new session, otherwise false.
Sort by customer_id in ascending order, then by viewed_at in ascending order. Include every page view, even each customer's first. No customer has duplicate page view timestamps.
customer_idviewed_atis_new_sessionShowing the first 3 rows of the sample — the full sample comes with Premium
Sign in to see submission history
Sign inSign in to use AI Mentor
Sign in