Identify Users with Specific Page Visit Sequence
Company: PayPal
Role: Data Scientist
Category: Data Manipulation (SQL/Python)
Difficulty: medium
Interview Round: Onsite
Overview: This question evaluates event-sequence detection and temporal ordering skills in SQL, focusing on concepts such as windowing, adjacent-row reasoning, and session-scoped grouping to identify ordered page visits.
Tables
page_visits(date DATE, user_id INTEGER, page_id VARCHAR(1), ts TIME)
Hints
- Use LEAD or ROW_NUMBER to look at the next page after each B, filter, then group.
- Partition window functions by user_id and date and order by ts to evaluate sequences.