Data Manipulation (SQL/Python) Interview Questions
Practice the exact questions companies are asking right now.
Compute ads revenue by geography in SQL
You have ad delivery logs for a shop-ads system. Tables ad_impressions - impression_id STRING (PK) - ts TIMESTAMP (UTC) - user_id STRING - shop_id STR...
Compute pirated-theme usage and revenue loss
You work on a theme marketplace. Some shops install pirated themes instead of paying for official themes. Assume all timestamps are in UTC. Tables sho...
Write SQL for content-view analytics
Context You work with page-view event logs and need to compute several engagement/usage summaries. Assume a single table: page_views | column | type |...
Retrieve First Active and Last Inactive Dates per User
Given a table activity that tracks user activities, write a SQL query to retrieve the first active date and last inactive date for each user. Table Sc...
Compute reply-based user metrics in 7 days
You are analyzing discussions on a social platform. Tables all_post - post_id (BIGINT, PK) - post_author_id (BIGINT, FK → user.user_id) - post_creatio...
Write SQL for video-call recipients and FR activity
Given the schema and samples below, write ANSI‑SQL to answer both questions. Assume dates are stored in UTC. Today is 2025-09-01, so “yesterday” is 20...
Calculate Response Rate and Compare User Survey Ratings
USERS user_id | signup_date 10 | 2024-03-20 11 | 2024-04-01 12 | 2024-04-05 SURVEYS survey_id | user_id | sent_at 1 | 10 ...
Analyze Spending Patterns and Restaurant Performance Using SQL/Python
orders +-------------+---------+---------------+---------------------+ | delivery_id | user_id | restaurant_id | order_date | +-------------+...
Merge overlapping intervals per group in pandas
You are given a pandas DataFrame df containing time intervals for multiple groups. Input df columns: - group_id (string/int): group identifier - start...
Compute active ad revenue by creation source
You work on an ads platform and need to report active ad revenue broken down by the ad’s creation source. Tables ads - ad_id BIGINT PK - advertiser_id...
Generate Weekly Revenue and Engagement Summary with Pandas
events | user_id | event_time | event_type | platform | revenue | |---------|---------------------|------------|----------|---------| | 101 ...
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...
Transform DataFrame and compute diff-in-diff
You are given a pandas DataFrame df with the following columns: - unit_id (string): entity identifier (e.g., user, city, driver) - group (string): eit...
Compute per-coin quarterly amounts and totals
Problem (SQL: Conditional Aggregation) You have two tables: coins - coin_id INT PRIMARY KEY - name VARCHAR transactions - id BIGINT PRIMARY KEY - coin...
Write SQL to compare social-only vs game-only engagement
You are given two tables capturing Oculus app usage. Define an 'active day' as a UTC date on which a user generates at least one event. Consider only ...
Compute percent of active users with 50+ calls
Problem You work on a Messenger-like app. You want to measure how many active users in Great Britain (GB) today have been heavy callers recently. Tabl...
Calculate Average Session Length and Compare App Performance
user_sessions +---------+------------+------------+---------------------+---------------------+ | user_id | session_id | app | session_start ...
Compute video-call SQL metrics with edge cases
Use 'today' = 2025-09-01. Assume UTC timestamps. Write SQL to answer both parts below and call out how your queries handle edge cases (duplicates, fai...
Write SQL for percent and window changes
Use PostgreSQL. Assume today = 2025-09-01. You must use CTEs and multiple window functions. Schema and tiny samples are below. Schema: - exposures(uni...
Debug ML pipeline and build text parser
- Given raw text files with noisy formatting, implement a robust parser that outputs structured examples; handle delimiters, quoting/escaping, encodin...