PracHub
QuestionsPremiumCoachesLearningGuidesInterview Prep

Quick Overview

This question evaluates a candidate's ability to perform event-level funnel analysis including distinct aggregation, joins to a dimension table, time-windowed filtering, handling missing events (such as completions without prior clicks), and computing safe conversion rates using SQL or Python.

  • hard
  • Google
  • Data Manipulation (SQL/Python)
  • Data Scientist

Compute Company Suggestion Funnels

Company: Google

Role: Data Scientist

Category: Data Manipulation (SQL/Python)

Difficulty: hard

Interview Round: Technical Screen

An AI workflow suggestion product logs suggestion-related events in a single event table. Table: `suggestion_events` - `event_id` STRING: unique event record ID. - `user_id` STRING: user who generated the event. - `company_id` STRING: company or tenant that the user belongs to. - `event_ts` TIMESTAMP: event timestamp stored in UTC. - `event_type` STRING: one of `shown`, `clicked`, or `completed`. - `suggestion_id` STRING: identifier of a suggestion instance shown to a user. Optional dimension table for the follow-up breakdown: Table: `suggestions` - `suggestion_id` STRING: primary key. - `suggestion_type` STRING: category of the suggestion, such as automation, debugging, cost optimization, or security. Relationship: `suggestion_events.suggestion_id` joins to `suggestions.suggestion_id`. Assume a suggestion can generate multiple event rows, so funnel counts should be based on distinct `suggestion_id` values within each company unless stated otherwise. Time window: use the last 30 days in UTC, defined as `event_ts >= analysis_ts - INTERVAL '30 days'` and `event_ts < analysis_ts`, where `analysis_ts` is the query run timestamp. Tasks: 1. For each `company_id`, calculate the suggestion funnel over the last 30 days. 2. Required output columns: `company_id`, `shown_count`, `clicked_count`, `completed_count`, `click_rate`, `completion_rate_from_shown`, `post_click_completion_rate`, and `completed_without_click_count`. 3. Define `shown_count` as distinct suggestions with at least one `shown` event, `clicked_count` as distinct suggestions with at least one `clicked` event, and `completed_count` as distinct suggestions with at least one `completed` event. 4. Define `click_rate = clicked_count / shown_count`, `completion_rate_from_shown = completed_count / shown_count`, and `post_click_completion_rate = completed_after_click_count / clicked_count`, using safe division when the denominator is zero. 5. If a suggestion has a `completed` event but no `clicked` event in the analysis window, include it in `completed_count`, exclude it from `completed_after_click_count`, and count it in `completed_without_click_count`. 6. Follow-up: modify the output to break down the same funnel by `suggestion_type` as well as `company_id`. If `suggestion_type` is not present on the event table, join to the `suggestions` dimension table.

Quick Answer: This question evaluates a candidate's ability to perform event-level funnel analysis including distinct aggregation, joins to a dimension table, time-windowed filtering, handling missing events (such as completions without prior clicks), and computing safe conversion rates using SQL or Python.

Last updated: May 31, 2026

Loading coding console...

PracHub

Master your tech interviews with 8,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

  • Generate binomial matrix and column-normalize - Google (Medium)
  • Analyze video flags and reviews with SQL - Google (Medium)
  • Write SQL/Python for messy event data - Google (Medium)
  • Add a conditional column in Python - Google (Medium)
  • Find most co‑purchased product pairs in SQL - Google (Medium)