← HBO Interview Insights

HBO·Data Scientist·Technical Phone Screen·Senior

Senior
May 2026

Summary

HBO Data Scientist technical screen, all SQL, three fairly involved problems covering aggregations with window functions, experiment analysis, and a ranked filtering task. The schema was realistic enough that it felt like actual work rather than a toy exercise.

Questions Asked (3)

Q1

Given a multi-table schema with views, directors, and users, write SQL to compute unique viewers, total watch-hours, and median watch-time per viewer by director for August 2022. Multiple views by the same user for the same director count as one viewer, and the per-viewer median uses each user's summed seconds for that director.

Product Analytics & MetricsData Modeling
Author's notes

The median part is what gets you.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clarifying the schema and definitions (e.g., what constitutes a view, how to handle nulls). Then write a SQL query that aggregates views per user-director, computes unique viewers and total watch-hours, and uses a window function or subquery to calculate the median watch-time per viewer for each director.

Pro tip: Mention that you would validate the results by checking edge cases (e.g., directors with few viewers) and consider performance implications of median calculation on large datasets, perhaps using approximate percentiles if exact median is too slow.

1. Understand the schema and requirements

Identify the relevant tables (views, directors, users) and their columns. Clarify what 'unique viewer' means (distinct user_id per director) and how to compute watch-hours (sum of seconds / 3600).

2. Filter and aggregate views per user-director

Filter views to August 2022. Group by director and user to sum watch seconds per user per director, ensuring multiple views by the same user for the same director are combined.

3. Compute unique viewers and total watch-hours per director

From the aggregated data, count distinct users per director for unique viewers and sum the total seconds per director, then convert to hours.

4. Calculate median watch-time per viewer per director

Use a window function (e.g., PERCENTILE_CONT) or a subquery with row numbering to find the median of the summed seconds per user for each director.

5. Combine metrics into final output

Join the unique viewers, total watch-hours, and median watch-time results by director, ensuring the output is clean and formatted.

Key Points to Mention

  • Use of DISTINCT COUNT for unique viewers
  • Conversion of seconds to hours (divide by 3600)
  • Handling of multiple views by same user (summing seconds before median)
  • Use of window functions or subqueries for median calculation
  • Filtering by date range (August 2022) using appropriate date functions
  • Consideration of NULL values or missing data in views

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.

Q2

For experiment HP123, compute 7-day post-exposure cancellation rates by variant. Only include users whose exposure happened before any cancellation, and count a cancellation as within-window if it falls strictly after exposure and within 7 days.

A/B Testing & ExperimentationProduct Analytics & Metrics
Author's notes

I overcomplicated the filtering step.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

First, clarify the experiment design and data schema, then write a SQL query that filters users to those exposed before any cancellation, computes cancellation events within 7 days post-exposure, and aggregates rates by variant. Validate the logic with edge cases and ensure the denominator includes only eligible users.

Pro tip: Always confirm the definition of 'cancellation' and 'exposure' with the interviewer—whether it's subscription cancellation, content cancellation, or something else—and check if multiple exposures per user exist. Also, consider using a window function to handle the 'before any cancellation' condition efficiently.

1. Clarify requirements and data schema

Ask about the experiment design, variant assignment, exposure and cancellation event tables, and how to identify users. Confirm the exact definition of cancellation and the 7-day window.

2. Filter eligible users

Select users whose exposure timestamp is strictly before their first cancellation timestamp (or who have no cancellation). This ensures we only include users at risk of cancelling after exposure.

3. Identify in-window cancellations

For each eligible user, check if they have a cancellation event that occurs strictly after exposure and within 7 days (i.e., cancellation_time > exposure_time AND cancellation_time <= exposure_time + 7 days).

4. Aggregate by variant

Group by variant and compute the cancellation rate as the number of users with an in-window cancellation divided by the total number of eligible users in that variant.

5. Validate and present results

Sanity-check the results (e.g., rates between 0 and 1, no missing variants), and consider statistical significance if needed. Present the rates clearly, perhaps with confidence intervals.

Key Points to Mention

  • Definition of exposure and cancellation events, and how to handle multiple exposures or cancellations per user.
  • Importance of filtering users to those exposed before any cancellation to avoid immortal time bias.
  • Use of strict inequality for the 7-day window (cancellation strictly after exposure and within 7 days).
  • Handling of users with no cancellation (they contribute to denominator but not numerator).
  • Aggregation by variant and calculation of rates as proportions.
  • Potential need for statistical testing or confidence intervals to compare variants.

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.

Q3

For August 2022, find the top 3 titles by unique viewers within each HP123 variant (A and B), but only among users who were exposed to the experiment before their first August view. Break ties by total watch-hours descending, then title alphabetically.

A/B Testing & ExperimentationData ModelingProduct Analytics & Metrics
Author's notes

This one has a lot of moving parts.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by defining the exposure cohort: users who were exposed to the experiment before their first view in August 2022. Then filter August views to those users, aggregate unique viewers and total watch-hours per title per variant, and rank titles within each variant using the specified tie-breakers. Finally, select the top 3 titles per variant.

Pro tip: Clarify whether 'exposed before their first August view' means exposure timestamp < first view timestamp in August, and ensure you handle users with multiple exposures correctly. Also, confirm that unique viewers are counted per title per variant, not globally.

1. Define exposure cohort

Identify users who were exposed to the experiment (variant A or B) before their first view in August 2022. This requires joining exposure data with view data and comparing timestamps.

2. Filter August views

Restrict to views that occurred in August 2022 and belong to users in the exposure cohort. Ensure each view is associated with the user's assigned variant.

3. Aggregate metrics per title and variant

For each title and variant, compute the number of unique viewers and total watch-hours. Use COUNT(DISTINCT user_id) for unique viewers and SUM(watch_hours) for total watch-hours.

4. Rank and select top 3

Within each variant, rank titles by unique viewers descending, then by total watch-hours descending, then by title alphabetically ascending. Select the top 3 titles per variant.

Key Points to Mention

  • Defining the exposure cohort correctly: exposure timestamp must be before the user's first view in August 2022.
  • Handling users with multiple exposures: use the earliest exposure or ensure the exposure is before the first August view.
  • Using COUNT(DISTINCT user_id) for unique viewers to avoid double-counting.
  • Aggregating watch-hours correctly, possibly summing over all views of a title by the user.
  • Applying the tie-breaking rules in the correct order: unique viewers desc, watch-hours desc, title asc.
  • Ensuring the analysis is done separately for each variant (A and B).

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.