InterviewStack.io LogoInterviewStack.io

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.

MediumTechnical
67 practiced

Write a query to find the latest/most recent record per entity when duplicates exist, for example the most recent version of a user record after repeated client retries, or a survey response table where you only want each user's latest response.

MediumTechnical
53 practiced

Write a data-profiling query: for every column in a table, return the null count, distinct count, min, and max (or a few sample values), so you can quickly assess a new dataset's quality before building on top of it.

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
56 practiced

Write a query to compute a simple customer lifetime value (LTV): total revenue per customer since signup, using orders(user_id, order_date, amount). Then classify customers into LTV buckets (low/medium/high).

MediumTechnical
64 practiced

Using conditional aggregation, pivot event counts into a wide report: one row per date with separate columns for each event type (for example views, add-to-carts, and purchases) over the last 7 days.

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.