← Intuit Interview Insights

Intuit·Data Scientist·Technical Phone Screen·Intermediate

Intermediate
Jun 2026

Summary

Intuit data scientist technical screen, one question, all SQL. The problem was a cohort retention query and it went deeper than I expected for a phone screen.

Questions Asked (1)

Q1

Given a users table with signup timestamps and a user_events table with event timestamps, write SQL to compute monthly cohort-based retention. Return cohort_month, month_number (0, 1, 2, ...), cohort size, retained users, and retention rate. A user is retained in month N if they have at least one event in the calendar month that is N months after their signup cohort month. Ignore events that occur before the user's signup timestamp.

Product Analytics & MetricsData Modeling
Author's notes

The month 0 case tripped me up first.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by defining the signup cohort month for each user, then join to events and compute the month offset between event and signup. Aggregate to count distinct retained users per cohort and month number, then calculate retention rate as retained divided by cohort size.

Pro tip: Clarify whether 'month N' means calendar month difference or 30-day periods, and explicitly state that you're using calendar month difference as implied by the question. Also mention that you'd handle edge cases like users with no events by including them in cohort size but not in retained counts.

1. Define cohorts

Create a CTE that selects user_id and truncates signup timestamp to month to get cohort_month. This establishes the cohort for each user.

2. Join events and filter

Join the cohorts CTE to the user_events table on user_id, ensuring event_timestamp >= signup_timestamp to ignore pre-signup events.

3. Compute month number

Calculate month_number as the difference in months between the event month and cohort_month, using a function like DATEDIFF(month, cohort_month, event_month) or equivalent.

4. Aggregate retention

Group by cohort_month and month_number, count distinct users as retained users. Also compute cohort size as the total distinct users in each cohort (from the cohorts CTE).

5. Calculate retention rate

Divide retained users by cohort size to get retention rate, and output the required columns: cohort_month, month_number, cohort_size, retained_users, retention_rate.

Key Points to Mention

  • Use of DISTINCT counts to avoid double-counting users with multiple events in a month.
  • Filtering events to only those on or after signup timestamp.
  • Handling of month_number 0 (signup month) and ensuring it's included.
  • Consideration of time zones and date truncation consistency.
  • Efficiency: using CTEs and proper indexing on user_id and timestamps.
  • Edge cases: users with no events, cohorts with zero retained users, and ensuring all cohorts are represented.

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