SQL is the king. Whether you want to be a data analyst, a data scientist or a data engineer - this is the skill required at each of these jobs.
This week I put together a full SQL roadmap — the path I would follow if I were starting from scratch today. My YouTube video this week goes deep into each stage, but everything you need to get started is right here.
Before we proceed — a small ad. Your clicks on the ads help me to cover newsletter hosting fees. Each click makes me ~$1. Thank you for your support!
Stop rewriting prompts. Start engineering loops.
Most developers still babysit AI one prompt at a time. Top engineers don't. They build loops: systems where AI plans, executes, and self-corrects while they focus on what matters. The Code built The Ultimate Guide to Loop Engineering to give you the exact techniques Silicon Valley engineers use to ship faster.
Sign up for The Code and get:
The Ultimate Guide to Loop Engineering, the patterns that turn AI from assistant into engine, plus real workflows you can set up today
The Code newsletter (5 min daily) to keep learning the agentic techniques keeping top engineers 6 months ahead
First, a quick note on tools
SQL is a language, not a software. The software you use to write and run SQL queries is called a database management system — or a client tool that connects to one.
If you are on Windows, I recommend starting with MS SQL Server and SQL Server Management Studio (SSMS) — both free to download from Microsoft. It is the most common setup in corporate environments and a great place to start.
If you are on Mac, MS SQL is not available, so go with MySQL (with MySQL Workbench as your visual interface) or PostgreSQL (with DBeaver). Both are free and widely used.
The difference between SQL and these tools: SQL is the language. MySQL Workbench, SSMS, and DBeaver are just the applications you use to write it — like the difference between English and Microsoft Word.
Stage 1 — The basics (start here)
Your first goal is simple: be able to look at one table and answer real questions from it.
Learn these first: SELECT, FROM, WHERE, ORDER BY, LIMIT, DISTINCT, and aliasing with AS. Then add the aggregates: COUNT, SUM, AVG, MIN, MAX, GROUP BY, HAVING.
That list covers the majority of what you will write for the rest of your career.
One thing beginners often skip (I learnt it years later): learn how SQL actually executes.
You write queries in this order — SELECT, FROM, WHERE, GROUP BY, HAVING, ORDER BY — but SQL runs them in a different order: FROM → WHERE → GROUP BY → HAVING → SELECT → ORDER BY → LIMIT.
A phrase I was taught to remember it: First We Got Hungry So Ordered Lunch.
Understanding execution order explains why certain things work and others break.
Also learn NULLs early. IS NULL, IS NOT NULL, COALESCE. NULL does not equal zero and it does not equal blank — it behaves differently from what most beginners expect.
Where to practise: SQLZoo (sqlzoo.net) is one of the best free resources for writing real queries from day one. W3Schools (w3schools.com/sql) is excellent as a reference when you need to look up syntax quickly (this is the resource I used, when learning SQL).
Stage 2 — Joins
Real data almost never lives in one table. A customers table, an orders table, a products table — your manager asks a question that needs to be extracted from all three. That is what joins are for.
Start with just two: INNER JOIN and LEFT JOIN.
The question to ask before every join: what does one row in each table represent? If one customer has five orders, joining those tables turns one customer row into five. If you did not expect that, your analysis is wrong from that point on. Always check your row count before and after a join on any unfamiliar dataset.
Stage 3 — Transforming data
CASE WHEN lets you create categories and flags directly inside a query — turning spend amounts into high, mid, and low value segments, or flagging whether a customer is active or churned. It is essentially feature engineering in machine learning.
Learn date functions too. You will constantly need things like orders in the last 30 days, days between signup and first purchase, or monthly revenue grouped by period. Date syntax differs between MySQL, PostgreSQL, BigQuery, and Snowflake — do not try to memorise everything, just understand what you are trying to do and look up the exact function for whichever system you are using.
Same with strings: TRIM, LOWER, UPPER, CONCAT, REPLACE. Learn the common operations and know the rest exist for when you need them.
Stage 4 — CTEs and window functions
CTEs (Common Table Expressions, written as WITH ... AS (...)) let you break a complex query into logical steps instead of nesting five subqueries inside each other. They make your queries readable, debuggable, and easier to build on.
Window functions are where SQL gets genuinely powerful. ROW_NUMBER, RANK, LAG, LEAD, SUM() OVER, PARTITION BY.
The one concept underneath all of them: GROUP BY collapses your rows down into one per group. Window functions let you calculate across a group while keeping every individual row intact.
A few examples of what this unlocks:
"What was each customer's previous transaction?" →
LAG"Find the most recent record per customer" →
ROW_NUMBER"Rank products by revenue within each category" →
RANK"Calculate a running total" →
SUM() OVER
Stage 5 — Build something real
The best way to make theory stick is to practice by doing.
Pick a free dataset with a few tables — something like an e-commerce dataset from Kaggle — and ask yourself a real question. Which customers have not purchased in the last 90 days? What is the average order value by country? Which product category generates the most revenue?
Then write the SQL to answer it. Join the tables, filter the data, aggregate the results. The goal is not to write perfect code — it is to go from a question to an answer using only SQL.
Useful resources
SQLZoo — sqlzoo.net — best for writing real queries from day one, with instant feedback
W3Schools SQL — w3schools.com/sql — go-to reference when you need to look up syntax fast
Windows: MS SQL Server + SSMS — both free at microsoft.com/sql-server
Mac: MySQL + MySQL Workbench — free at mysql.com/downloads, or PostgreSQL + DBeaver — free at postgresql.org and dbeaver.io
Full SQL Roadmap is in this week’s video → https://youtu.be/wp-69qgkyAQ
Keep pushing 💪,
Karina
Just starting with Python? Wondering if programming is for you?
Master key data analysis tasks like cleaning, filtering, pivot and grouping data using Pandas, and learn how to present your insights visually with Matplotlib with ‘Data Analysis with Python’ masterclass.
Already know the basics and want something more hands-on?
Take the Python Challenge.
You'll work through a real business problem, complete a portfolio-ready project, and practise the kind of analysis employers expect from junior analysts.
👉 Start with the Masterclass if you're a complete beginner.
👉 Choose the Python Challenge if you're comfortable with the fundamentals and want to apply them to a real project.
Data Analyst & Data Scientist


