SQL study plans
A list of 161 exercises is hard to start. These plans put the same exercises in a fixed order with a clear end, so you know what to do today and when you are finished.
- 14-day SQL interview sprint41 exercises in 14 days. Two weeks, three exercises a day, in the order a SQL interview tends to escalate: filters and NULLs, grouping, joins, subqueries, then the window function questions and the classics such as the second highest salary, the median and retention.
- SQL for data analyst interviews24 exercises in 8 sessions. A data analyst is mostly asked to turn a table into an answer: how many, how much, which group, compared with last month. This plan follows that work in eight sessions, from filters and grouped totals through joins and missing rows to ranking, running totals and a monthly report built step by step.
- SQL for BI analyst interviews21 exercises in 7 sessions. BI work is metrics that have to be right every time the dashboard refreshes: totals per period, subtotals, share of total, change on the previous period and the top items in each group. This plan drills those patterns in seven sessions and ends with a product performance review.
- SQL for data engineer interviews24 exercises in 8 sessions. Data engineering SQL is less about the report and more about whether the rows can be trusted: values typed three ways, amounts stored as text, duplicates, keys with no match, gaps in a sequence. This plan covers those in eight sessions.
- Product analytics SQL in four sessions12 exercises in 4 sessions. Product and growth teams ask the same questions in every interview: how many users are active, where the funnel loses people, who comes back and who leaves. All of them run on one table of events, and all of them go wrong in the same places: events counted as users, daily numbers added up, a second event on day one counted as a return.
- SQL traps and time periods in three sessions10 exercises in 3 sessions. Some queries run without an error and still return the wrong number: a join that repeats rows, a whole-number division, a comparison with NULL, a tie that LIMIT cuts off. Interviewers use these on purpose, because they show who checks a result and who trusts it.
- Window functions in six sessions18 exercises in 6 sessions. Window functions decide most SQL interviews above entry level. This plan takes them one idea at a time: ranking, running totals, the previous and next row, the first row of a group, shares of a total, and finally the questions that combine them.
- SQL on messy data: one work week16 exercises in 5 days. Real tables are not clean. Countries are typed three ways, amounts are stored as text, dates come in two formats and the same person signed up twice. These exercises use a table like that, and the answers only pass once the cleaning is right.
- PostgreSQL features in four sessions11 exercises in 4 sessions. Standard SQL gets you most of the way. These exercises cover the parts that are specific to PostgreSQL and that people who use it every day reach for: ILIKE, FILTER, date_trunc, ROLLUP, string_agg, DISTINCT ON, LATERAL and generate_series.
Business cases
One open question from a manager, answered in four or five queries that build on each other, the way the work actually arrives.
- The refund review5 steps. The head of sales thinks refunds are getting out of hand and wants facts by Friday. You have the orders, the customers and the order lines. Five queries take the question apart: the trend by month, the markets, the customers, the product categories, and the summary line for the top of the email.
- The payroll review5 steps. Finance is preparing next year's budget and asks for the people numbers: how many people each department has and what they cost, which departments pay above the company average, how concentrated the pay is, how the team grew, and how large each manager's team is.
- The monthly revenue report4 steps. Your manager wants the monthly revenue report rebuilt in SQL so it stops living in a spreadsheet. It has four columns that build on each other: revenue per month, the change on the previous month, the running total for the year, and each month's share of the total.
- Customer value and segments4 steps. Marketing wants to know who the valuable customers are before planning a campaign. You build it up from the orders: what each customer has spent, when they first and last ordered, which segment that puts them in, and how large each segment is.
- Product performance4 steps. The buying team reviews the range every quarter and needs four answers: what each product sold, how the categories compare, which product leads each category, and which products have never been part of a paid order.
Your first 8 exercises are free, with no account, from any plan or level.