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

Write a query to find users who placed at least 3 orders in the last 12 months and whose average order value is above a given amount. Given orders(order_id, user_id, amount_cents, created_at), return the qualifying user_ids.

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.

EasyTechnical
59 practiced

Walk me through the differences between INNER JOIN, LEFT JOIN, RIGHT JOIN, and FULL OUTER JOIN. Using two small tables (say customers and orders), show how the result set and row counts change for each join type, and call out what happens to unmatched rows on each side.

MediumTechnical
59 practiced

You're handed a long, deeply nested SQL query full of duplicated subquery expressions that a teammate says is 'impossible to review.' Refactor it into a readable series of CTEs and explain how you decided where to break it up.

EasyTechnical
71 practiced

Write a query to find customers who have never placed an order. Given customers(customer_id, email) and orders(order_id, customer_id), return customer_id and email for every customer with zero matching orders.

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.