One candidate we saw lost an onsite at a payments company because their JOIN fan-out turned a 40-row expected result into 12,000 duplicated rows and they couldn't explain why in under two minutes. That's what these exercises train for. Real schemas. Real tables. Real failure modes. You write the query, the grader runs it against Postgres, and you see exactly what your logic produced, not a green check on pattern matching.
150+ exercises. Eight categories. Every query hits a live database. Break things fast so you don't break them in the interview.
SQL challenges shipped
Companies in dataset
INNER JOIN frequency
PARTITION BY frequency
Source: DataDriven analysis of 1,042 verified data engineering interview rounds.
Each category targets a specific SQL skill that appears in real interviews. They are ordered roughly by frequency: the topics you will see most often are at the top.
COUNT, SUM, AVG, MIN, MAX with GROUP BY, HAVING, and conditional aggregation. This is the single most-tested SQL category in data engineering interviews. Nearly one in four SQL questions involves grouping rows and computing summary statistics.
Skills covered:
Sample question:
Given an orders table, find each customer's total spend, number of orders, and average order value. Only include customers with more than 5 orders.
INNER, LEFT, RIGHT, FULL OUTER, CROSS, and self-joins. JOIN questions are the second most common topic in SQL interviews. The tricky part is not the syntax. It is predicting the output row count and handling NULLs from non-matching rows.
Skills covered:
Sample question:
Find all customers who signed up in 2024 but never placed an order. Return their name and signup date.
ROW_NUMBER, RANK, DENSE_RANK, LAG, LEAD, SUM OVER, AVG OVER, and frame clauses. Window functions separate senior-level candidates from juniors. If you can write a correct window function under time pressure, you are in the top quartile of SQL interviewees.
Skills covered:
Sample question:
For each department, rank employees by salary (highest first). Return the top 3 earners per department, handling ties.
Scalar subqueries, correlated subqueries, EXISTS, IN, and Common Table Expressions. CTEs make complex queries readable. Correlated subqueries test whether you understand how the inner query references the outer query. Both appear frequently in interviews.
Skills covered:
Sample question:
Using a CTE, find all products whose price is above the average price in their category. Return the product name, price, and category average.
SUBSTRING, CONCAT, REPLACE, TRIM, UPPER, LOWER, DATE_TRUNC, DATE_DIFF, EXTRACT, and interval arithmetic. These questions are less glamorous than window functions but they appear consistently. Interviewers use them to test attention to detail and edge case handling.
Skills covered:
Sample question:
Given a user events table with a timestamp column, compute the number of active users per week for the last 12 weeks. A user is active if they had at least one event that week.
CASE WHEN is the if/else of SQL. It shows up in almost every non-trivial query: conditional aggregation, pivot-style transformations, bucketing values into categories, and computing derived columns. Mastering CASE WHEN means you can express any business rule in SQL.
Skills covered:
Sample question:
Classify each order as 'small' (under $50), 'medium' ($50-200), or 'large' (over $200). Then count the number of orders in each category per month.
Three-valued logic, COALESCE, NULLIF, IS NULL, IS NOT NULL, and how NULLs interact with JOINs, aggregations, and comparisons. NULL behavior is one of the most common sources of bugs in production SQL. Interviewers love it because it reveals whether you actually understand the language or just memorize patterns.
Skills covered:
Sample question:
A LEFT JOIN produces NULLs in the right table columns. Write a query that counts both matched and unmatched rows, replacing NULLs with meaningful defaults.
Gap-and-island problems, running totals, sessionization, deduplication, pivot/unpivot, and recursive queries. These are the problems that show up in final rounds at top companies. They combine multiple SQL concepts into a single question.
Skills covered:
Sample question:
Given a table of user logins with timestamps, identify 'sessions' where consecutive logins are within 30 minutes of each other. Assign a session_id to each group.
Skipping ahead is how people waste six weeks. We watched a bootcamp grad grind window function problems for a month before realizing she couldn't reliably write a three-table JOIN. Walk the progression in order. Eight weeks. No shortcuts.
Focus: SELECT, WHERE, GROUP BY, HAVING, ORDER BY, LIMIT
You can write basic queries without looking up syntax. Aggregations with GROUP BY feel natural.
Start with Aggregation exercises (beginner level) and basic JOINs.
Focus: Multi-table JOINs, subqueries, CTEs, CASE WHEN
You can combine 2-3 tables, use CTEs to break down complex logic, and write conditional aggregations.
Move to intermediate JOIN exercises, CTE practice, and CASE WHEN drills.
Focus: Window functions, date/string manipulation, NULL edge cases
ROW_NUMBER, RANK, LAG, and LEAD feel comfortable. You spot NULL traps before they bite.
Window function exercises, date function drills, NULL handling challenges.
Focus: Gap-and-island, sessionization, recursive CTEs, optimization
You can solve multi-step problems under time pressure. Your queries are correct on the first try most of the time.
Advanced pattern exercises. Timed practice: 5 questions in 60 minutes.
Volume matters, but it is not the only factor. How you practice determines how fast you improve. These five strategies separate people who plateau at 50 exercises from people who are interview-ready at 100.
The fastest path to interview-ready SQL is writing a wrong query and debugging it. Start now.