How to learn SQL from scratch: a stage-by-stage roadmap, practice and how to pick a course
To learn SQL from scratch, start with SELECT, WHERE, ORDER BY and aggregate functions on a practice database, then move on to JOIN, subqueries and window functions. With about five hours a week, as a rough guide, you can write useful queries within a month and feel comfortable with real reports in two or three. What speeds things up most is practising on data you understand, not just watching videos.
Why SQL is the first data skill worth learning
SQL is the language you use to ask a relational database for data, and nearly every business system keeps its information in one: the ERP, the CRM, the billing platform, the online store. Knowing SQL lets you go to the source instead of waiting for someone to export a file for you. It is a small language compared with a general-purpose one: about twenty well-understood statements cover most day-to-day work.
In client projects we see that whoever can query the database directly quickly becomes the team’s go-to person for business questions. Not because SQL is hard, but because it removes the steps in between: copying, pasting, matching sheets by hand and hoping nobody renamed a column. And what you learn carries over to PostgreSQL, MySQL, SQL Server or BigQuery, with minor syntax differences.
What to learn and in what order
The order matters more than the course. If you jump into JOIN before filters feel natural, every error looks like a mystery. The path we recommend goes from reading a single table, to combining several, to writing queries that summarise information the way a report would. The times in the table below are rough and assume about five hours a week; more time shortens them, less stretches them, and that is fine.
A good sign that you are ready to move on is being able to say out loud what a query will return before you run it. If you still copy the syntax of a GROUP BY every time, or the results often surprise you, stay another week in the current stage. Moving ahead with gaps costs more later, because each stage assumes everything before it.
- Stage 1: SELECT, WHERE, ORDER BY, LIMIT and operators such as IN, BETWEEN and LIKE.
- Stage 2: COUNT, SUM, AVG, GROUP BY and HAVING to summarise data.
- Stage 3: INNER JOIN and LEFT JOIN, and understanding why a badly written JOIN duplicates rows.
- Stage 4: subqueries, CTEs with WITH, CASE WHEN and handling null values.
- Stage 5: window functions (ROW_NUMBER, LAG, SUM OVER), indexes and reading execution plans.
Set up your practice environment in an afternoon
You do not need a server or a cloud account to start. PostgreSQL installs on any computer, and SQLite does not even need installing: it is just a file. As a visual client, DBeaver is free and works with almost any engine. If you would rather not install anything, browser-based SQL editors are fine for the first few weeks, although they fall short once you want to load your own data.
For data, use a sample database with several related tables, such as the ones that simulate a shop with customers, orders and products. As soon as you can, import a CSV of your own: your expenses for the year, the sales of a family business or a public dataset from your city. With data you understand, you notice right away when a query returns something absurd, and that is the hardest skill to teach.
Practice projects that actually teach
Isolated exercises help with syntax, but confidence comes from projects with a business question behind them. Each project should force you to decide which tables to join, what to filter and how to present the result. These work well, ordered from easier to harder:
The last project is the one we recommend most. It is exactly what we do when a client brings us a process that lives in Excel: split the sheet into entities, define keys and discover that half the formulas were compensating for badly entered data. Doing it once on a small scale teaches you more about data modelling than any theory chapter.
- Monthly sales report: totals by month, product and city, with the change against the previous month.
- Customers who stopped buying: who bought last year but not this year, using LEFT JOIN or NOT EXISTS.
- The top three products per category with ROW_NUMBER, a classic in technical interviews.
- Cleaning a messy CSV: dates in mixed formats, names with stray spaces and duplicates.
- Moving an Excel sheet you use at work into two or three related tables and rebuilding its calculations in SQL.
Common mistakes when learning SQL
Most stumbles are about logic, not syntax. The engine runs what you wrote, not what you meant, and a query that runs without errors can still return the wrong number. These are the mistakes we see most, both in beginners and in teams that have used SQL for a while:
One habit fixes almost all of them: check every query against a figure you already know. If you know there were around a hundred orders in March and your query returns three thousand, something got duplicated along the way. That habit of distrusting the result is what separates someone who writes SQL from someone who analyses data with SQL.
- Trusting the total without checking whether a JOIN duplicated rows. Count rows before and after every JOIN.
- Forgetting that NULL equals nothing, not even another NULL: use IS NULL and COALESCE.
- Filtering in WHERE what belongs in HAVING, or the other way round.
- Using SELECT * on large tables and getting used to pulling columns you do not need.
- Studying only with videos and never writing a query from a blank editor.
How to choose a SQL course
There are plenty of SQL courses and almost all of them cover the same ground in the first chapters; the difference is in the rest. Before buying, open the full syllabus and check that it reaches at least subqueries and window functions. A course that ends at JOIN leaves you halfway. Also look at the last update date and whether the instructor answers questions in the Q&A section.
On language: there are good Spanish-language courses for the fundamentals, and since SQL keywords are in English anyway, moving to English material later is not a big jump. If your goal is data analysis, prefer courses that use PostgreSQL or a cloud engine; if you work with corporate systems, one based on SQL Server saves you syntax adjustments.
- Exercises with solutions after every section, not only at the end.
- A downloadable database so you can practise on your own machine.
- Projects built around business questions, not just isolated queries.
- Recent reviews that mention how clear the explanations are.
When SQL is no longer enough
SQL is excellent for asking and summarising, but not for everything. When you need to automate a process that pulls from several sources, calls an API or sends emails, a language like Python or an automation tool comes in. When the result has to be read by someone who does not know SQL, you need a visualisation layer such as Power BI or Looker Studio. And when the data grows a lot, the problem becomes one of modelling and infrastructure.
None of that replaces SQL; it is built on top of it. In the data projects we build for clients, most of the logic still lives in queries, even when the end user only sees a dashboard. So if you are going to learn a single technical data skill this year, SQL is the safest bet.
| Stage | What to learn | Suggested practice | Rough time |
|---|---|---|---|
| Basic queries | SELECT, WHERE, ORDER BY, LIMIT, operators | Filter a customer or product table | 1 to 2 weeks |
| Aggregations | COUNT, SUM, AVG, GROUP BY, HAVING | Sales by month and category | 1 to 2 weeks |
| Joining tables | INNER JOIN, LEFT JOIN, primary and foreign keys | Orders with customer and product details | 2 to 3 weeks |
| Intermediate queries | Subqueries, CTEs, CASE WHEN, nulls | Inactive customers and segmentation | 2 to 3 weeks |
| Advanced analysis | Window functions, indexes, execution plans | Rankings, running totals and period-over-period changes | 3 to 4 weeks |
Where the courses are
Frequently asked questions
How long does it take to learn SQL from scratch?
At about five hours a week, you can write useful work queries within one or two months, and handle JOIN, subqueries and window functions comfortably in three or four. Treat that as a rough guide: it depends on how much time you put in and whether you practise on real data.
Do I need to know how to code to learn SQL?
No. SQL is declarative: you describe the data you want and the engine works out how to get it, with no loops or variables at the basic level. Plenty of people in finance, operations or marketing learn it without ever having coded.
Which database engine should I use to learn?
PostgreSQL is a very good place to start: it is free, follows the standard closely and is widely used in industry. If your workplace runs SQL Server or MySQL, learn on that one so you do not have to translate syntax; the essentials are the same everywhere.
Are there good SQL courses in Spanish?
Yes, there are well-structured Spanish-language courses for the fundamentals. Check that the syllabus reaches window functions, includes exercises with solutions and has been updated recently. Language matters less than with other tools, because SQL keywords are in English anyway.
SQL or Python: which should I learn first for data work?
SQL first, in most cases. It is quicker to learn, it is used every day to pull data out of systems and it underpins almost every report. Python makes more sense once you can query and need to automate, clean complex data or run statistical analysis.
Some links in TintoDev Academy are affiliate links. If you make a purchase through them, TintoDev may earn a commission at no additional cost to you.
