← Openai Interview Insights

Openai·Data Scientist·Take-home Assignment·Senior

SeniorPrefer not to say
May 2026

Summary

SQL take-home for a Data Scientist role at OpenAI. One question, pretty involved, centered on building an experiment metrics report from scratch. The problem was well-scoped but had enough edge cases to trip you up if you rushed.

Questions Asked (1)

Q1

Write a SQL query to measure the performance of a free-month promotion experiment. Given an experiment_users table and a subscription_events table, return one row per variant with counts for eligible users, signups within 30 days, paid conversions within 60 days, churn within 90 days of first paid start, and a churn rate column.

A/B Testing & ExperimentationProduct Analytics & MetricsData Modeling
Author's notes

The churn definition is what got me.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clarifying the schema and metric definitions, then build a base table of eligible users per variant. Use conditional aggregation with date arithmetic to compute each metric, and finally calculate churn rate as churned users divided by converted users.

Pro tip: Always state your assumptions about the schema and metric definitions before writing SQL—this shows you think like a data scientist, not just a coder. Also, use CTEs to break the query into logical steps, making it easier to debug and explain.

1. Clarify schema and metric definitions

Ask about the columns in experiment_users and subscription_events, and confirm how to define eligible users, signups, paid conversions, and churn. This ensures you're solving the right problem.

2. Identify eligible users per variant

Filter experiment_users to those who are eligible for the promotion (e.g., new users, correct experiment assignment) and group by variant. This forms the denominator for signup rate.

3. Compute signups and paid conversions

Join with subscription_events to count users who signed up within 30 days of eligibility and then converted to paid within 60 days of signup. Use date functions and conditional aggregation.

4. Calculate churn within 90 days of first paid start

For users who converted, find their first paid start date and check if they churned within 90 days. Count these users per variant.

5. Compute churn rate and final output

Divide churned users by converted users to get churn rate, and output one row per variant with all counts and the rate. Use a final SELECT with proper aliases.

Key Points to Mention

  • Use of CTEs to structure the query and improve readability
  • Conditional aggregation with CASE WHEN for counting events within time windows
  • Date arithmetic functions (e.g., DATE_ADD, DATEDIFF) to enforce time constraints
  • Handling of users with multiple events (e.g., first paid start) using window functions or subqueries
  • Definition of churn rate as churned / converted, and ensuring denominators are correct
  • Assumptions about data cleanliness, such as no duplicate events or missing timestamps

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