PracHub
QuestionsPremiumLearningGuidesCheatsheetNEWCoaches

Quick 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.

  • Medium
  • PayPal
  • Data Manipulation (SQL/Python)
  • Data Scientist

Identify Users with Specific Page Visit Sequence

Company: PayPal

Role: Data Scientist

Category: Data Manipulation (SQL/Python)

Difficulty: Medium

Interview Round: Onsite

page_visits +------------+---------+---------+----------+ | date | user_id | page_id | ts | +------------+---------+---------+----------+ |2024-06-01 | 101 | A |08:00:01 | |2024-06-01 | 101 | B |08:05:10 | |2024-06-01 | 101 | D |08:07:00 | |2024-06-01 | 102 | A |09:00:00 | |2024-06-01 | 102 | B |09:02:00 | +------------+---------+---------+----------+ ##### Scenario Website analytics team wants to find users who, within one calendar day, visited page A followed by page B where the first page immediately after B is NOT page C. ##### Question Given table page_visits(date, user_id, page_id, ts), write SQL to return distinct user_ids who, on the same date, have the sequence A → B with no C directly after that B (A→B and A→B→D→C qualify; A→B→C does not). ##### Hints Use LEAD or ROW_NUMBER to look at the next page after each B, filter, then group.

Quick Answer: 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.

Last updated: Mar 29, 2026

Loading coding console...

PracHub

Master your tech interviews with 7,500+ real questions from top companies.

Product

  • Questions
  • Learning Tracks
  • Interview Guides
  • Resources
  • Premium
  • For Universities
  • Student Access

Browse

  • By Company
  • By Role
  • By Category
  • Topic Hubs
  • SQL Questions
  • Compare Platforms
  • Discord Community

Support

  • support@prachub.com
  • (916) 541-4762

Legal

  • Privacy Policy
  • Terms of Service
  • About Us

© 2026 PracHub. All rights reserved.

Related Coding Questions

  • Write SQL using HAVING and window functions - PayPal (easy)
  • Write SQL for top drivers and cancellation rates - PayPal (easy)
  • Compute top orders and cancellation rate - PayPal (easy)
  • Write SQL to flag Venmo ATO - PayPal (Medium)
  • Write conditional aggregation SQL queries - PayPal (Medium)