PracHub
QuestionsPremiumLearningGuidesCheatsheetNEWCoaches

Quick Overview

This question evaluates proficiency in temporal schema design and event-level data modeling, focusing on reconstructing time-varying subscription state using SQL and Python in the Data Manipulation (SQL/Python) domain.

  • Medium
  • OpenAI
  • Data Manipulation (SQL/Python)
  • Data Scientist

Design Schema for Accurate Subscription State Tracking

Company: OpenAI

Role: Data Scientist

Category: Data Manipulation (SQL/Python)

Difficulty: Medium

Interview Round: Take-home Project

subscription_events +----------+---------------------+-----------+-----------+ | user_id | event_ts | event_type| plan_type | +----------+---------------------+-----------+-----------+ | 1001 | 2024-04-01 08:20:00 | signup | free | | 1001 | 2024-04-15 10:05:00 | cancel | free | | 1001 | 2024-04-20 11:30:00 | signup | paid_trial| | 1002 | 2024-04-02 09:00:00 | signup | free | | 1003 | 2024-04-03 12:10:00 | signup | paid_trial| +----------+---------------------+-----------+-----------+ ##### Scenario Design the raw event table that feeds the experiment metrics, handling edge cases where a user can signup, cancel, then signup again. ##### Question Propose an event-level schema that supports accurate daily subscription status reconstruction. Write SQL or Python logic that derives each user’s subscription state for any date, correctly accounting for multiple signup-cancel cycles. ##### Hints Event sourcing + window/aggregation; last event before snapshot determines state.

Quick Answer: This question evaluates proficiency in temporal schema design and event-level data modeling, focusing on reconstructing time-varying subscription state using SQL and Python in the Data Manipulation (SQL/Python) domain.

Last updated: Mar 29, 2026

Loading coding console...

PracHub

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

  • Write SQL for repeat churn - OpenAI (hard)
  • Handle repeated churn in SQL - OpenAI (hard)
  • Compute churn with re-subscriptions - OpenAI (hard)
  • Debug and harden trial-assignment Python code - OpenAI (Medium)
  • Write SQL for post-trial conversion cohorts - OpenAI (Medium)