Tiktok Data Scientist Data Manipulation (SQL/Python) Interview Questions
Master your tech interview with our curated database of real questions from top companies.
Calculate User Registration Date and 7-Day Retention Rate
user_posts +---------+--------------+-----------+ | user_id | posting_date | num_posts | +---------+--------------+-----------+ | 1 | 2023-01-01...
Compute 7-Day Rolling Average of Unique Post Viewers
POST_VIEWS +---------+------------+---------+ | user_id | view_date | post_id | | 101 | 2023-08-01 | 10 | | 102 | 2023-08-01 | 11 |...
Identify Top Discounts and Monitor Code Submissions
Products +------------+----------+-------+----------+ | product_id | category | price | discount | +------------+----------+-------+----------+ | 101 ...
Analyze and Clean European Ecommerce Sales Data
sales +----------+-------------+------------+---------+---------+----------------+ | order_id | customer_id | order_date | country | revenue | product...
Tiktok DS Interview Questions
Scenario: You are provided with two tables: minute_streamed and minute_viewed. The minute_streamed table records each minute of streaming activity, wh...
Compute last-to-previous ad impression gaps
Given impressions(ad_id INT, user_id INT, impression_ts TIMESTAMP) with multiple impressions per (user_id, ad_id), write a single SQL query to return,...
Compute CTR drop with exclusions
Assume today = 2025-09-01. Using ad delivery logs, find advertisers whose CTR in the last 7 days (2025-08-25 to 2025-08-31) dropped by at least 20% re...
Compare SQL counts, windows, and NULL semantics
You’re given two tables. users(id INT, country STRING, created_at DATE) rows: 1 | US | 2025-08-28 2 | US | 2025-08-30 3 | IN | 2025-08-29 4 | BR | 202...
Compute 7-day rolling complaint/order ratio in SQL
SQL only. Given the schema and sample data below, write a single Postgres query (no procedural code) to compute a 7-day rolling complaint-to-order rat...
Calculate valid daily usage with gap constraints
Write Standard SQL to compute, for a given date (use 2025-09-01), each user's total valid usage minutes. Schema and rules: Schema (timestamps are UTC)...
Write SQL for last-7-day metrics without windows
Assume today is 2025-09-01. Use ANSI SQL only and do not use window functions. You may use subqueries, GROUP BY, HAVING, and JOINs. Schema and small s...
Select 10% Users Randomly from User Table
users +----+----------+-------------+ | id | username | signup_date | +----+----------+-------------+ | 1 | alice | 2023-01-02 | | 2 | bob ...
Analyze Posting Behavior by Cohort and Date
creator_post +------------+---------+------+ | post_date | user_id | post | +------------+---------+------+ | 2023-01-01 | 111 | 1 | | 2023-01...
Calculate Day-7 Retention Rate from User Post Data
post_activity +---------+------------+-------+ | user_id | post_date | posts | +---------+------------+-------+ | 1 | 2023-01-01 | 3 | | 1 ...
Calculate Monthly Conversion Rate and Average Order Value
page_views +-----------+---------+---------------------+ | user_id | page_id | view_timestamp | +-----------+---------+---------------------+ |...
Calculate Conversion Rate from Ad Clicks to Page Visits
user_events | user_id | event_time | event_type | ad_id | |---------|----------------------|------------|-------| | 1 | 2023-01-01 10:...
Identify Repeat Advertisers from Consecutive Weeks
SUBMISSIONS +--------------+-----------+-----------+ | advertiser_id| ad_id | week_id | +--------------+-----------+-----------+ | A123 ...