Free course

Learn SQL Online Free: A Structured Course with Exercises

32 tutorials · 42 exercises · Updated September 10, 2026

This is the whole site arranged as a course. It is free, it needs no account, and every step is something you do, not just read: each tutorial’s examples open in the playground with one click, and each module ends with exercises that check your answer by running it. Work through the five modules in order and you will go from “what is a table?” to writing the multi-step queries that data analyst interviews ask for.

Who this is for

  • Complete beginners who have never written a query. Module 1 assumes nothing.
  • Analysts and marketers who use spreadsheets and want to query the database directly.
  • Developers who copy-paste SQL and want to actually understand joins, grouping and subqueries.
  • Job seekers preparing for a SQL round: modules 4 and 5 are built around what gets asked.

How the course works

  1. Read a short tutorial. Every one is example-driven and builds only on the ones before it.
  2. Run every example. The Run button on each code block opens it live; change it, break it, see what happens.
  3. Solve the module’s exercises. Your query is executed against the sample database and compared with the expected result, so any correct answer passes. When you are wrong, you see the expected rows next to yours.

Progress is saved in your browser (there are no accounts), and each practice path awards a certificate of completion you can download when every exercise in it is solved. Time estimates below are honest ones for a first pass, reading plus exercises; take longer if you like.

The curriculum

1

Foundations: reading data from one table

Beginner · about 3 hours

Read

Practise

The 10 Foundations exercises: choosing columns, filtering with every operator, sorting, limiting, DISTINCT and NULL. Open the first exercise →

You will be able to

  • Explain what a table, row and column are and read a schema.
  • Write SELECT queries with WHERE, AND/OR, IN, BETWEEN, LIKE, IS NULL, ORDER BY and LIMIT.
  • Avoid the beginner traps: NULL comparisons, operator precedence, case sensitivity.
2

Combining and summarising data

Beginner to intermediate · about 4 hours

Read

Practise

The 10 Grouping & Joins exercises: counts, averages, per-group totals, HAVING, joins across two and three tables, and LEFT JOIN for the rows with nothing on the other side. Open the first exercise →

You will be able to

  • Choose the right join type and predict which rows survive.
  • Aggregate with COUNT, SUM, AVG, MIN, MAX and group them correctly.
  • Know why WHERE cannot filter an aggregate and when HAVING is the answer.
3

Changing data and asking layered questions

Intermediate · about 3 hours

Read

Practise

The 8 Advanced Queries exercises: comparisons against an average, EXISTS and NOT EXISTS, self joins for managers, UNION, and revenue questions that need a subquery inside a join. Open the first exercise →

You will be able to

  • Add, change and remove rows without destroying a table (the SELECT-first habit).
  • Write scalar, IN, EXISTS and correlated subqueries, and know when a JOIN is cleaner.
  • Read a query from the inside out.
4

Expressions, text, dates and reports

Intermediate · about 4 hours

Read

Practise

The 14 Expressions & Reports exercises: labelling rows with CASE, one-row status reports, text cleanup, monthly grouping, and multi-step reports built from chained CTEs. Open the first exercise →

You will be able to

  • Turn business rules into CASE expressions and pivot-style summaries.
  • Structure a long query as named steps with WITH.
  • Clean text and group by month without losing rows.
5

Advanced SQL and interview preparation

Advanced · about 3 hours

Read

Practise

Re-solve the hardest exercises from modules 2–4 without hints, then work the ten analyst scenarios with the solutions hidden. The cheat sheet is your reference from here on. Open the first exercise →

You will be able to

  • Rank, number and compare rows within groups.
  • Answer the interview classics with a clear explanation, not just a query.
  • Translate a query between the four major dialects.

How long does it take?

Roughly 17 hours of focused work for a first pass through everything, which most people spread over three to six weeks at an hour a day. There is no benefit to rushing it: the exercises are where the learning happens, and a query you struggled with sticks far better than one you read. If you already know the basics, start at module 2 and use the exercises to find your gaps.

What you will not find here

No videos to sit through, no locked chapters, no email gate, no “premium” tier. The whole site, including the playground and every exercise, is free and runs in your browser. It is also deliberately dialect-neutral: what you learn works on PostgreSQL, MySQL, SQL Server and SQLite, and where they differ, the dialect guide says so.

Start now

Open the beginner’s guide and keep the playground in another tab. Or, if you would rather test yourself first, go straight to the exercises and see how far you get.

Frequently asked questions

Is this SQL course really free?

Yes, all of it. There is no paid tier, no signup and no email gate. The tutorials, the 42 exercises with answer checking, the playground and the certificates are free to everyone.

Do I need to install a database?

No. The whole course runs in your browser, including the database engine, so there is nothing to install and nothing to configure. It even keeps working offline for pages you have already opened.

Which SQL dialect does the course teach?

Standard SQL wherever possible, so what you learn works on PostgreSQL, MySQL, SQL Server and SQLite. Where those databases differ, the tutorials say so, and there is a dedicated dialect comparison page.

How long does it take to learn SQL with this course?

About 17 hours of focused work for a full first pass, which most people spread over three to six weeks. Someone who already knows the basics can start at module 2 and finish faster.

Can I get a certificate?

Each of the four practice paths awards a certificate of completion once every exercise in it is solved. It is generated in your browser with the name you type, and it records what you actually completed here rather than an accredited qualification.

About the author

SQL Practice

SQL Practice publishes free SQL tutorials, an in-browser playground and 42 practice exercises, built so you can run what you read. Every runnable example in our tutorials is executed against the site’s sample database before it is published. Read how we keep tutorials accurate, or report a mistake.