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

Write a query that produces total revenue and number of unique customers per calendar month for the last 12 months from a transactions table. Handle the case where a month has zero activity and it should still appear as a zero row.

HardTechnical
73 practiced

How would you build a lightweight Excel dashboard that refreshes from a raw data tab, shows KPI tiles, trend charts, and drill-down filters, and stays fast enough for daily use on a large workbook? Describe the structure, formulas, and performance choices you would make.

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.

EasyTechnical
73 practiced

What's a window function, and when would you reach for one instead of GROUP BY? Give one example where GROUP BY collapses the rows you need and a window function (like a running total or a per-row rank) is the right tool because you still need one row per input row.

HardTechnical
98 practiced

Not every company's reporting period lines up with the calendar month. Given a transactions table and a fiscal_calendar lookup table mapping calendar dates to fiscal year/month, write a query that aggregates revenue by fiscal period, and explain why you'd model this as a join to a calendar table rather than date arithmetic.

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.