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
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.

MediumTechnical
76 practiced

For business reporting, how do SUMIFS, COUNTIFS, and AVERAGEIFS compare with PivotTables? When would you prefer conditional aggregate formulas instead of a PivotTable, and when would you avoid them?

MediumTechnical
64 practiced

You receive a CSV export with inconsistent date formats, extra spaces, merged cells in headers, and product names that differ only by spelling or casing. How would you clean and structure it in Excel so it can be analyzed reliably without losing the original raw data?

EasyTechnical
70 practiced

Write a query that classifies customers into spend tiers using CASE WHEN, for example 'low' / 'medium' / 'high' based on lifetime order total, and returns the count of customers in each tier.

EasyTechnical
62 practiced

Write a query that computes Daily Active Users (DAU) for a given month: for each date, the count of distinct users with at least one event that day.

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.