SQL for Data Analysis Questions

Writing SQL to answer analytical and business questions. Covers filtering, joins, grouping and aggregation, subqueries, CTEs, and translating an ambiguous request into a correct query. Includes spreadsheet-to-SQL fluency for everyday analyst workflows.

HardTechnical
63 practiced

Given a contracts table where revenue is recognized evenly over the contract term, write SQL to produce recognized revenue per month across the whole portfolio, correctly prorating any contract whose start or end falls mid-month.

MediumTechnical
75 practiced

Write a query to compute simple weekly retention for new users: define the cohort as signup week, and for each cohort week report the percentage of users who had at least one event in each of the following weeks.

MediumTechnical
77 practiced

How does SQL handle NULL? Explain why col != 'x' silently drops rows where col is NULL, why you need IS NULL / IS NOT NULL instead of = NULL, and what COALESCE does. Then show how NULL affects COUNT(*), COUNT(column), and an AVG() computed after a LEFT JOIN.

MediumTechnical
60 practiced

Write a query to compute daily conversion_rate = conversions / active_users for each day, using two separately aggregated subqueries (or CTEs) in the FROM clause joined together, rather than one giant query.

MediumTechnical
69 practiced

Write a query to find users who placed at least 3 orders in the last 12 months and whose average order value is above a given amount. Given orders(order_id, user_id, amount_cents, created_at), return the qualifying user_ids.

Unlock Full Question Bank

Get access to all SQL for Data Analysis interview questions and detailed answers.

Sign in to Continue

Join thousands of developers preparing for their dream job.