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

You're ingesting raw data with messy formatting, for example transaction amounts stored as strings like '$1,234.56' or emails with inconsistent casing and stray whitespace. Write SQL to clean and standardize these values for downstream analysis.

EasyTechnical
64 practiced

When would you reach for SQL instead of doing the analysis in a spreadsheet or a BI tool's built-in functions (like a pivot table or VLOOKUP-style lookup)? Give two concrete examples of tasks that are much better done in SQL and explain what a spreadsheet approach would struggle with.

MediumTechnical
70 practiced

What's the difference between 'retention' and 'churn' as growth-analytics terms, and what are two different ways you could define each in SQL depending on the business (subscription cancellation vs. inactivity-based churn)? Explain the trade-offs of each definition.

HardTechnical
111 practiced

An orders table stores order_date in UTC, but you need to report 'orders placed on 2025-11-01' in each customer's local time. Given a users table with a timezone column, write a query that buckets orders correctly by each user's local date, and explain the pitfall of just applying one global UTC offset.

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.