SQL for Data Analysis Questions
Using SQL as a tool for data analysis and reporting. Focuses on writing queries to extract metrics, perform aggregations, join disparate data sources, use subqueries and window functions for trends and rankings, and prepare data for dashboards and reports. Includes best practices for reproducible analytical queries, handling time series and date arithmetic, basic query optimization considerations for analytic workloads, and when to use SQL versus built in reporting tools in analytics platforms.
MediumTechnical
69 practiced
Your dashboard query that joins events to users and filters a date range is slow on a 200M-row events table. As a PM working with an analyst, outline a step-by-step approach to diagnose and optimize the query (SQL-level and infra-level). Mention tools/queries you'd run to identify bottlenecks.
MediumTechnical
75 practiced
As a PM you need analytical SQL to be reproducible and easy for others to use. Describe how you would structure a canonical SQL query for monthly active users so it's parameterized, documented, tested, and reusable across dashboards. Provide a short example CTE structure.
HardTechnical
53 practiced
Given events(user_id, event_name, occurred_at, campaign_id) and campaigns(campaign_id, channel), write SQL that outputs, per user, first_touch_channel, last_touch_channel, first_touch_date, last_touch_date using the earliest and latest campaign_id associated with the user. Discuss tie-breakers and NULL campaign handling.
MediumTechnical
56 practiced
Write SQL to compute average revenue per user (ARPU) for the top 5 countries and calculate a 95% confidence interval for the mean revenue using SQL aggregates. Use transactions(transaction_id, user_id, amount) and users(user_id, country). State distributional assumptions and sample size caveats.
HardTechnical
70 practiced
Write SQL to compute the top 10 products that increased the most in revenue rank between week N-1 and week N. Use transactions(product_id, amount, occurred_at). Output product_id, rank_last_week, rank_this_week, rank_change.
Unlock Full Question Bank
Get access to hundreds of SQL for Data Analysis interview questions and detailed answers.
Sign in to ContinueJoin thousands of developers preparing for their dream job.