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

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.

MediumTechnical
58 practiced

Write a query that computes month-over-month percentage change in total revenue, one row per month. Explain how you'd handle the first month in the series (no prior month to compare against).

HardTechnical
64 practiced

A stakeholder says: 'define an activated user as someone who has completed steps A and B within 14 days of signup.' Walk through how you'd turn that into a precise SQL definition, what edge cases you'd need to clarify (what if they complete B before A? what if signup date is missing?), and write the query.

MediumTechnical
75 practiced

Write a query to compute simple weekly retention for new users: define the cohort as signup week, and for each cohort week report the percentage of users who had at least one event in each of the following weeks.

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.