How to Learn SQL from Scratch: The Roadmap
SQL is one of the most rewarding skills in IT: the language hasn't changed in decades, takes weeks to learn, and is needed everywhere — from analytics to backend. This article is a step-by-step plan: what to learn, in which order, how long it takes and what beginners trip over most often.
Tick off the weeks right in the article — your progress is saved in the browser, turning this page into a personal tracker.
How Long It Takes
Realistic timelines with 30–60 minutes of study a day:
- 2 weeks — a confident SELECT: filtered queries, sorting, aggregation. Already enough to pull data for reports.
- 4–6 weeks — the base level: joining tables, subqueries, modifying data. This is the minimum asked at intern and junior interviews.
- 2–3 months — a solid junior level: window functions, transactions, an understanding of indexes.
You don't need to know how to program: SQL is a declarative language — you describe what you want, not how to get it. No math beyond school level is required either.
The main rule for the whole journey: 20% of the time reading, 80% writing queries by hand. SQL cannot be learned with your eyes.
Week 1. Understand What We Work With and Write Your First SELECT
The goal of the week is to grasp how databases are organized and run your first queries.
- What a database and a DBMS are
- Relational databases and their structure: tables, records, keys
- What SQL is
- The basic syntax of an SQL query — your first SELECT
And here is your first query — it is live, press “run”:
MySQL 8.1SELECT name, category, price FROM products ORDER BY price DESC LIMIT 3;
You just asked the database for the three most expensive products — and it answered. Change 3 to 5 or DESC to ASC and watch the result change.
No need to install a DBMS on your computer: in the interactive course queries run right in the browser, and MySQL and PostgreSQL switch with one toggle.
Week 2. Filters and Sorting
The goal is to learn to pull exactly the rows you need from a table.
- The WHERE conditional operator
- IS NULL, BETWEEN, IN operators
- Pattern search: LIKE
- Sorting: ORDER BY
- Removing duplicates: DISTINCT
- Limiting results: LIMIT
After this week, start solving exercises in the trainer — 2–3 a day, starting with easy ones. Exercises give you what reading can't: the ability to translate a plain-language question into an SQL query.
Week 3. Aggregation: From Rows to Numbers
The goal is to answer "how many", "on average", "maximum per group".
- Grouping: GROUP BY
- Aggregate functions: COUNT, SUM, AVG, MIN, MAX
- Filtering groups: HAVING
- Using functions
This is also the place to understand the difference between WHERE and HAVING — the number one interview question on this topic.
Week 4. Joining Tables — the Heart of SQL
In real databases the data is always spread across several tables, and nearly every work query joins two or three of them. This is the most important week of the course.
Don't rush: make the difference between INNER JOIN and LEFT JOIN feel obvious at the intuition level. Everything that follows builds on it.
Week 5. Subqueries, CTEs and Conditional Logic
The goal is to assemble queries out of several steps.
- Subqueries and correlated subqueries
- Common table expressions: WITH — plus our deep dive into CTEs with recursion
- Conditional logic: CASE
Week 6. Modifying Data and Creating Tables
Up to this point you have only read data — now we learn to change it.
- Inserting data: INSERT
- Updating: UPDATE
- Deleting: DELETE — and how DELETE differs from TRUNCATE and DROP
- Creating tables, data types and constraints
That closes out the base level: you can read, count, join and modify data.
Here is a query that by this point you will be able not just to read but to write yourself — a join, grouping and sorting all in one:
MySQL 8.1SELECT u.country, COUNT(*) AS orders_count, ROUND(AVG(o.total_amount), 2) AS avg_check FROM orders o JOIN users u ON u.user_id = o.user_id GROUP BY u.country ORDER BY orders_count DESC;
If every line here makes sense — base SQL is in your pocket.
Next: What Separates a Junior from an Intern
Once the basics sit firmly in your hands, add the topics that come up most at junior-and-above interviews:
- Window functions — the course lessons and our breakdown of ROW_NUMBER, RANK and DENSE_RANK. The most "valuable" topic for analysts.
- Transactions — the lessons and the article on the ACID properties. A classic of theory questions.
- Indexes — the lesson on indexes: what they are and why queries get hundreds of times faster.
- Interview prep — the interview questions section with real company tasks.
Five Mistakes That Slow Beginners Down
- Reading without practice. Syntax you read is forgotten in three days; a query written by hand stays. Any topic without 5–10 solved exercises is an unfinished topic.
- Starting with a DBMS installation. You can burn an evening installing and configuring MySQL and burn out before your first query. Start in the browser-based trainer and install a local database when you actually need one.
- Memorizing functions by the list. You don't need hundreds of functions: 90% of the work is done by COUNT, SUM, AVG, COALESCE and a couple of string functions. The rest takes a minute to look up in the handbook.
- Jumping into window functions before JOIN. Trendy topics don't stick without the foundation. The order of the weeks above is not accidental.
- Learning "in general", without a goal. Spell out why you need SQL: pass an interview, automate reports, move into analytics. The goal determines what to emphasize and when to stop.
Where to Start Right Now
The plan is simple: open the first lesson of the course — it is free, as is the whole base course — and complete week 1. Finish it — come back here and tick the first checkbox. After six weeks of regular study you will have a skill listed as a requirement in every second job posting for analysts, QA engineers and backend developers.
And once the base is done, you can go deeper with the advanced courses: database design, query optimization and data analysis in SQL.
Related articles
Database Normalization: Normal Forms Explained Simply
1NF, 2NF and 3NF on a single running example
ACID: The 4 Properties of Database Transactions Explained Simply
Atomicity, consistency, isolation, durability — through a money transfer example
ROW_NUMBER vs RANK vs DENSE_RANK in SQL: The Difference in One Example
Three ranking functions, one query — and the difference is visible