PracHub
QuestionsCoachesLearningGuidesInterview Prep

Quick Overview

This question evaluates the ability to compute cohort-based early engagement metrics and Day-30 retention using time-windowed joins, aggregation, bucketing, and handling edge cases such as users with zero or pre-signup transactions.

  • easy
  • Chime
  • Data Manipulation (SQL/Python)
  • Data Scientist

Compute early signals for user retention

Company: Chime

Role: Data Scientist

Category: Data Manipulation (SQL/Python)

Difficulty: easy

Interview Round: Technical Screen

You are given two tables that track signups and user transactions. ## Tables ### `users` - `user_id` (STRING, **PK**) — unique user - `signup_ts` (TIMESTAMP) — time the user signed up (assume UTC) ### `transactions` - `transaction_id` (STRING, **PK**) - `user_id` (STRING, **FK → users.user_id**) - `transaction_ts` (TIMESTAMP) — time of transaction (UTC) - `amount` (NUMERIC) — transaction amount ## Task You want an **early signal** that predicts **Day-30 retention**. 1) Define an **early engagement metric** as the number of transactions a user makes in the first **7 days after signup**: - `early_txn_cnt` = count of `transactions` where `transaction_ts >= signup_ts` and `transaction_ts < signup_ts + 7 days`. 2) Define **Day-30 retention** as whether the user has **at least one transaction** in the window **[signup + 30 days, signup + 37 days)**. - `is_retained_d30` ∈ {0,1} 3) Write a SQL query that outputs retention performance by early-engagement bucket: - Bucket `early_txn_cnt` into: `0`, `1`, `2`, `3+` ## Required output Return one row per bucket with: - `early_txn_bucket` - `users_in_bucket` - `retained_users` - `retention_rate` (= `retained_users` / `users_in_bucket`, as a decimal) ## Notes / assumptions - Include users with zero transactions. - If a user has transactions before `signup_ts`, ignore them. - If multiple transactions occur in the retention window, the user still counts as retained once.

Quick Answer: This question evaluates the ability to compute cohort-based early engagement metrics and Day-30 retention using time-windowed joins, aggregation, bucketing, and handling edge cases such as users with zero or pre-signup transactions.

Last updated: Mar 29, 2026

Loading coding console...

PracHub

Master your tech interviews with 8,000+ 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
  • AI Coding 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

  • Write SQL for noisy A/B launch metrics - Chime (Medium)
  • Write rolling-window SQL over weekly cohorts - Chime (Medium)
  • Analyze Acquisition Channels for User Value and Retention - Chime (Medium)