Find the Most Common Next Page After Each Google Help Center Article
Last updated: November 29, 2026
Quick Overview
From Google Help Center pageview logs, find the top five next pages (including exiting the site) after each article, ignoring refreshes of the same page, and report each transition's share.
0
0
0 solved
From Google Help Center pageview logs, find the top five next pages (including exiting the site) after each article, ignoring refreshes of the same page, and report each transition's share.
Help Center content teams want to know whether an article resolves the problem (users exit) or sends people onward to contact support. An onsite SQL interviewer uses this to test LEAD within sessions, handling of consecutive duplicate views, and top-N per group.
What the Interviewer Expects
- Use LEAD within a session ordered by time
- Collapse consecutive views of the same page before computing transitions
- Represent end of session as an explicit exit outcome
- Compute shares with a windowed total per source page
- Return top five per article with deterministic ties
Key Topics to Cover
How to Approach This
- Clarify the schema and expected output format before writing queries.
- Use CTEs (WITH clauses) to break complex queries into readable steps.
- Consider window functions (ROW_NUMBER, RANK, LAG, LEAD) for ranking and sequential analysis.
- Watch for NULLs, duplicates, and edge cases in JOINs and GROUP BY.
- For pandas, prefer vectorized operations over row-by-row iteration.
Possible Follow-up Questions
- How would you identify articles that most often lead to the contact support page?
- Exit could mean success or giving up. How would you tell them apart?
- How would you compute two-step paths, not just the next page?
Sharpen Your Skills on Codemia
Practice similar problems with our interactive workspace, get AI feedback, and track your progress.
Practice SQL ProblemsSample Answer
Clarify the Data
help_pageviews(session_id, view_ts, page_id) and help_articles(page_id, product, title). Sessions are already defined. Refreshing or switching tabs can log the same page twice in a row; those shou...
Approach
First drop consecutive repeats with LAG(page_id) per session. Then LEAD(page_id) gives each view's next page; a NULL means the session ended, which I label (exit). Count transitions per (page, n...