PracHub
QuestionsPremiumLearningGuidesInterview PrepNEWCoaches

Quick Overview

This question evaluates a candidate's competency in SQL and Python data wrangling, emphasizing date arithmetic, window functions, grouping, and conditional aggregation for cohort and retention calculations.

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

Calculate Day-7 Retention Rate from User Post Data

Company: TikTok

Role: Data Scientist

Category: Data Manipulation (SQL/Python)

Difficulty: Medium

Interview Round: Technical Screen

post_activity +---------+------------+-------+ | user_id | post_date | posts | +---------+------------+-------+ | 1 | 2023-01-01 | 3 | | 1 | 2023-01-02 | 2 | | 2 | 2023-04-10 | 1 | | 2 | 2023-04-11 | 4 | | 3 | 2023-05-05 | 5 | +---------+------------+-------+ ##### Scenario SQL data wrangling for user posting behavior analytics. ##### Question Given a table of daily post counts, derive each user's registration date (their first post_date). For every user, calculate the total number of posts made within their first 7 days on the platform. Compute the Day-7 retention rate: the proportion of users who posted on their 7th day relative to those who posted on Day-1. ##### Hints Use window functions, date arithmetic, group by, and conditional aggregation.

Quick Answer: This question evaluates a candidate's competency in SQL and Python data wrangling, emphasizing date arithmetic, window functions, grouping, and conditional aggregation for cohort and retention calculations.

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

  • Find high-value crypto users and top-CTR product - TikTok (easy)
  • Write monthly customer and sales SQL queries - TikTok (easy)
  • Find top-paid employee per department - TikTok (easy)
  • Count buggy vs non-buggy by employer - TikTok (Medium)
  • Select max-discount product per category - TikTok (Medium)