SQL Roadmap: The Order to Learn SQL, and Why
By Owen Middleton · Updated November 2026 · We ran the examples on PostgreSQL 17
Here is the SQL roadmap in short. First, learn queries on one table, and NULL with them. Next, learn GROUP BY and joins. Then learn CASE, subqueries, window functions, and dates and text. After that, learn CTEs and totals by day or month. For a data analyst job, you need 34 of the 66 lessons in our course, and you can leave database design, INSERT and UPDATE until later.
The SQL roadmap in 12 steps
We made these 12 steps from the 66 lessons of SQLMaxx Learn, a SQL course with no signup to start, which we built.
Each step is a set of lessons, with a line on what you can do after it. Each lesson name is a link to a free lesson page.
- Start at the top. An arrow goes from a step to a later step that needs it.
- Steps on the same row do not need each other, so take them in any order.
- "Analyst: 6 of 8" means that you need 6 of the 8 lessons in that step for a data analyst job.
Analyst marks a lesson that you need for a data analyst job. Take the other lessons when you meet them in a query.
-
Step 1: Read one table
You can pick rows and columns from one table, sort them, and find the rows where a value is missing.
Needs: nothing. Start here. For a data analyst job: 6 of 8 lessons
-
Step 2: Values and conditions
You can filter on several conditions, on a list or on a pattern, and change the type of a value.
Needs: step 1 (Read one table) For a data analyst job: 3 of 4 lessons
-
Step 3: Count and group
You can count and add up the rows of each group, and keep only the groups that you want.
Needs: step 1 (Read one table) For a data analyst job: 3 of 3 lessons
- Aggregate Functions (COUNT, SUM, AVG, MIN, MAX) Analyst
- GROUP BY Analyst
- HAVING Analyst
-
Step 4: Join tables
You can put two or more tables together, and keep the rows that have no match in the other table.
Needs: step 1 (Read one table) For a data analyst job: 4 of 6 lessons
- INNER JOIN Analyst
- LEFT JOIN and RIGHT JOIN Analyst
- FULL OUTER JOIN
- CROSS JOIN
- Joining Multiple Tables Analyst
- Self-Joins Analyst
You can leave self-joins until after step 6, but take them before Correlated Subqueries.
-
Step 5: CASE and missing values
You can put rows into groups that you name, and replace missing values before you count them.
Needs: step 2 (Values and conditions), step 3 (Count and group) and step 4 (Join tables) For a data analyst job: 2 of 5 lessons
-
Step 6: Subqueries and UNION
You can use the result of one query inside a different query, and put two results into one list.
Needs: step 2 (Values and conditions) and step 3 (Count and group) For a data analyst job: 3 of 4 lessons
-
Step 7: Window functions
You can rank rows and compare each row with the row before it, and keep every row in the result.
Needs: step 3 (Count and group) For a data analyst job: 4 of 7 lessons
-
Step 8: Dates and text
You can group rows by month, find the time between two dates, and clean text values.
Needs: step 2 (Values and conditions) For a data analyst job: 3 of 6 lessons
-
Step 9: CTEs
You can write a long query in named parts that you read from top to bottom.
Needs: step 6 (Subqueries and UNION) For a data analyst job: 1 of 3 lessons
-
Step 10: Reports over time
You can report on each day or month, show a zero for an empty day, and add running totals.
Needs: step 4 (Join tables), step 7 (Window functions), step 8 (Dates and text) and step 9 (CTEs) For a data analyst job: 2 of 6 lessons
- Above this line: most of what you need for a data analyst job. Three analyst lessons are below it, in steps 11 and 12.
-
Step 11: Specialist tools
You can use JSON data, recursive queries, LATERAL joins and correlated subqueries when you need them for a task.
Needs: step 5 (CASE and missing values) and step 10 (Reports over time) For a data analyst job: 1 of 7 lessons
-
Step 12: Reliable queries
You can find why a total is too large, read a query plan, and pick a subquery, CTE or join.
Needs: step 11 (Specialist tools) For a data analyst job: 2 of 7 lessons
Why learn SQL in this order?
Four parts of the order matter most.
Why NULL comes first on the SQL roadmap
In SQL, a missing value is NULL, and NULL is not equal to anything, not even to NULL. When you count a column, you do not count its NULL values, and you get no error. So learn NULL in step 1, before you count rows in step 3 and before LEFT JOIN in step 4, where you get NULL values in your result. You meet NULL again in most later lessons.
GROUP BY before SQL window functions
With a window function, you do the work of a GROUP BY and keep every row. If you can write a GROUP BY, you already know the idea behind PARTITION BY. To start, read window functions explained.
SQL subqueries before CTEs
A CTE is a subquery with a name, at the top of the query. When you know subqueries from step 6, a CTE in step 9 is a small step. For the next part, read Common Table Expressions explained.
SQL GROUP BY and joins in either order
You do not need GROUP BY to learn joins, or joins to learn GROUP BY, so take steps 3 and 4 in either order. We put GROUP BY first, because in the study in the section below, students found GROUP BY easier than joins.
SQL roadmap for a data analyst
For a data analyst job, take the 34 lessons marked Analyst, in step order. In them, you learn the topics of levels 1 and 2 on our analyst checklist, and the lessons that you need before those topics.
Most of them are in steps 1 to 10. Three are in later steps, but you can take them early. Take Reading EXPLAIN Output after step 4. Take Correlated Subqueries after step 6. Take Query Structure Patterns for Performance after step 9 and after Reading EXPLAIN Output and Correlated Subqueries.
When you finish the Analyst lessons, take NULL Handling in Joins and Aggregates (step 5), then Join Fanout and Aggregate Correctness (step 12). In Join Fanout and Aggregate Correctness, you learn why a total can be too large after a join. You do not need step 11 for it.
You will also use DISTINCT, LIMIT and ROW_NUMBER. They have no Analyst mark, so learn them when you meet them in a query.
If your work is to read data and report on it, do not start with database design. The authors of one SQL roadmap tell you to start with database architecture and normalization. For an analyst, we think that is the wrong start.
For a business analyst job where you write your own queries, take the same Analyst lessons, and check the SQL in the job posts that you apply to.
For how long this takes, see how long SQL takes to learn. On that page, we give one time for lessons 1 to 41. The analyst lessons here are 27 of those lessons and 7 later lessons, so use that time as a rough guide.
What can you skip on the SQL roadmap?
Whatever your goal, you can skip two things at the start:
- RIGHT JOIN practice. You can write each RIGHT JOIN as a LEFT JOIN with the two tables in the other order. So learn LEFT JOIN well, and read a RIGHT JOIN when you see one.
- Step 11 (JSON, recursive queries, LATERAL joins and the rest), until you need it for a task.
For a data analyst job, you can also leave chained CTEs, temporary tables and date spines. From steps 11 and 12, take only Correlated Subqueries, Join Fanout and Aggregate Correctness and the two lessons on query plans and speed.
If you build apps, you also need INSERT, UPDATE, DELETE and database design. SQLMaxx Learn has no lessons on them, so take a different course for that part.
Where do people get stuck on the SQL roadmap?
SQL joins and subqueries are the hardest part
In a study of the SQL that students wrote, queries on one table were the easiest. Queries with GROUP BY were harder, joins were harder again, and subqueries and self-joins were the hardest. When you get too many rows after a join, count the rows before the join and after it.
Wrong numbers from SQL GROUP BY and NULL
With GROUP BY and with NULL, you can get a wrong number and no error message: a total that is too large after a join, or a count that leaves out the NULL values. Check one group by hand before you trust the report.
Free SQL courses that stop before window functions
Of the eight free SQL courses that we checked, in five, we found no lesson on window functions. If you finish a course with no window functions, you are near step 7, about halfway. You have finished the course, not SQL.
Step 1 of the SQL roadmap for beginners
You query the categories table of Brightlane, our practice online store. Each category is inside a larger category, except the categories at the top. Find the categories with no larger category:
Schema · ecommerce1 table? = nullable
SELECT name, parent_id FROM categories WHERE parent_id = NULL;
| name | parent_id |
|---|
You get zero rows, and you get no error. Change = NULL to IS NULL and run
it again. Now you get four rows: the categories at the top. This is why NULL is in step 1.
| name | parent_id |
|---|---|
| Electronics | NULL |
| Clothing | NULL |
| Home & Garden | NULL |
| Books | NULL |
In SQLMaxx Learn, you do not have to plan the order yourself. Each time, you get a next lesson that you are ready for.
Questions about the SQL roadmap
What is a good roadmap for learning SQL?
Learn queries on one table and NULL first. Then learn GROUP BY and joins, then CASE, subqueries, window functions and dates, then CTEs and totals by day or month. For a data analyst job, you need 34 of the 66 lessons in SQLMaxx Learn, our own course. Leave database design and INSERT for later, unless you build apps.
Do I need INSERT, UPDATE and DELETE on a SQL roadmap?
If your job is to read data, not at the start. If you build apps, yes. SQLMaxx Learn has no lessons on them.
Where should a beginner start the SQL roadmap?
Start with queries on one table: SELECT, FROM and WHERE. Learn NULL at the same time, before you count rows or join tables.
What comes after the SQL roadmap?
Practice on real questions, from a blank editor. After the Analyst lessons, learn NULL Handling in Joins and Aggregates, then Join Fanout and Aggregate Correctness. For period over period growth and funnels, check the job posts that you apply to.
How we know what is on this SQL roadmap
In this SQL course roadmap, we put each of the 66 lessons of SQLMaxx Learn in one step. We take the arrows, the rows of the figure and the analyst counts from the lesson prerequisites.
The arrows. We draw an arrow from step A to step B when you need a lesson of step A before a lesson of step B. We do not draw an arrow when you can already go from A to B along a longer path of arrows. Of the 36 links between steps, we draw 18. We put each step on a row below every step that you need before it, with at most three steps on a row.
Two choices. We put the NULL lesson in step 1, because you need only the WHERE lesson before it. We put FIRST_VALUE in step 11, not with the window functions, because you also need COALESCE from step 5 before it. An arrow from step 5 to step 7 would be true for this one lesson only.
The analyst count. We start from the 23 lessons of levels 1 and 2 on our analyst checklist. Then we add every lesson that you need before them, directly or through other lessons. That is 34 lessons. Some analyst lessons are under the analyst line. For each one, we give the last step that you need before it. If you also need another analyst lesson under the line, we name that lesson. We draw the analyst line under the first row with 9 in 10 of the analyst lessons on it or above it.
The source of the design-first example is the SQL roadmap of DataCamp: see the DataCamp note below.
The study. The order of difficulty in the section on where people get stuck is from Ahadi and others, 2015, a study of the SQL queries that students wrote.
The free courses. We count a course as one with no lesson on window functions when we found none in its topics: five of the eight courses above DataCamp.
SQLBolt: SQL course topics
SQLBolt sells no course: the lessons are free, and SQLBolt asks for an optional donation. Checked October 12, 2026 (source)
- SQLBolt has exercises on joins, outer joins and GROUP BY. For subqueries, it has a text page with no exercise. It has no lesson on window functions. Checked October 12, 2026 (source)
Khan Academy: SQL course topics
Khan Academy is a nonprofit and asks for donations. The course is free. Checked October 12, 2026 (source)
- There are lessons on HAVING, IN subqueries, CASE, and inner, outer and self joins in the course. There are no lessons on window functions or CTEs. Checked October 12, 2026 (source)
freeCodeCamp: SQL course topics
freeCodeCamp is a donor-supported charity. The course is free. Checked October 12, 2026 (source)
- In the Student Database workshop, you learn aggregate functions, GROUP BY, HAVING, and inner, left, right and full joins. We found no lesson on subqueries or window functions. Checked October 12, 2026 (source)
W3Schools: SQL course topics
W3Schools sells a SQL certificate exam. The tutorial is free. Checked October 12, 2026 (source)
- W3Schools has tutorial pages on joins, GROUP BY, HAVING, EXISTS and CASE. We found no window functions in its menu. Checked October 12, 2026 (source)
SQLZoo: SQL course topics
SQLZoo is free. We found no paid plan on the site. Checked October 12, 2026 (source)
- SQLZoo has tutorials on GROUP BY, joins, self joins, window functions, and SELECT within SELECT (subqueries). Checked October 12, 2026 (source)
DataLemur: SQL course topics
DataLemur sells Premium access to "100+ SQL Interview questions" with hints and full solutions. The SQL tutorial is free. Checked October 23, 2026 (source)
- DataLemur has tutorial lessons on GROUP BY, joins, CTEs, subqueries, window functions, LEAD and LAG, and self joins. Checked October 23, 2026 (source)
ThoughtSpot: SQL course topics
ThoughtSpot sells an analytics product: its site menu has a "Pricing" link and a "FREE TRIAL" for it. The SQL tutorial is free, and we found no price on the tutorial pages. Checked November 12, 2026 (source)
- ThoughtSpot has lessons on GROUP BY, HAVING, CASE, inner and outer joins, subqueries, and window functions. Checked October 12, 2026 (source)
Codecademy: SQL course topics
Codecademy sells Plus and Pro subscriptions to its courses and paths. The Basic plan is free. Checked November 10, 2026 (source)
- In the Learn SQL course, Codecademy has the lessons Manipulation, Queries, Aggregate Functions and Multiple Tables. In Aggregate Functions, you do the exercises "Group By I", "Group By II" and "Having". In Multiple Tables, you do exercises on inner joins, left joins, cross joins, UNION and WITH. In the WITH exercise, you put a query in a WITH statement and join it to a table. We found no lesson exercise on subqueries or window functions. Checked October 23, 2026 (source)
- The lessons are free. With a free account, you can also do 2 projects and 2 quizzes. For more projects and quizzes, and for the certificate, you need a paid plan. Checked November 10, 2026 (source)
DataCamp: its SQL roadmap
DataCamp sells a subscription to its data and AI courses. Checked November 10, 2026 (source)
- In its SQL roadmap, DataCamp writes for months 1 to 2: "Build a strong foundation in database architecture, normalization, and environment setup." Checked November 12, 2026 (source)