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.

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

A manager asks you to explain why sales dropped last week, and the only input you have is a raw Excel export from the CRM. How would you structure the investigation in Excel from the first pass to the final answer, and what analyses would you prioritize?

HardTechnical
56 practiced

Given a touchpoints table (user, channel, touch time) and a purchases table, write SQL to attribute each purchase's revenue under two simple models: first-touch and last-touch. Explain when a stakeholder would prefer one over the other.

HardTechnical
69 practiced

Given a subscriptions table (start_date, end_date, monthly price) where an active subscription has a NULL end_date, write SQL to calculate current Monthly Recurring Revenue (MRR) as of a given date, prorating partial months correctly.

MediumTechnical
69 practiced

You notice invalid values entering a pricing table, for example negative prices or inconsistent currency codes. Write a query that flags the offending rows and summarizes how many rows are affected by each issue type.

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.