Online SQL course: learn queries by writing them
Six levels that take you from your first SELECT to reports across several tables, with a project at the end of each level and a final test. You practice on a real database in your browser and get feedback straight away.
In short: this is a self-paced course with no instructor and no fixed dates. Each lesson explains one idea and then has you write queries that are checked on the spot. All of level 1 is free, and from level 2 on the first exercise of every lesson is free.
Try it now
Here is a real exercise from the course. The database belongs to a small online store selling office supplies, and the table you need is shown above the editor. Run shows your result, Check tells you whether it is right.
Task Sales is planning visits in Boston. From the customers table, show the columns name and phone, but only for customers whose city is Boston.
customers 12 rows, 7 columns
| customer_id | name | city | country | customer_since | segment | phone |
|---|---|---|---|---|---|---|
| 1 | Harbor Fremont Partners | Boston | USA | 2021-03-15 | Business | 617-555-0142 |
| 2 | Emily Carter | Chicago | USA | 2022-07-01 | Consumer | NULL |
| 3 | Riverside County Office | Riverside | USA | 2020-11-20 | Government | 951-555-0110 |
| 4 | Raj Patel | Leeds | UK | 2023-01-09 | Consumer | 0113 496 0123 |
| 5 | Lakeview Hotel Ltd | Manchester | UK | 2022-04-18 | Business | 0161 496 0456 |
| 6 | Olivia Brooks | Austin | USA | 2024-02-27 | Consumer | NULL |
| 7 | Greene & Shaw LLP | London | UK | 2021-09-05 | Business | 020 7946 0321 |
| 8 | Maple Grove High School | Austin | USA | 2023-08-14 | School | 512-555-0187 |
| 9 | Chloe Evans | Boston | USA | 2025-05-30 | Consumer | 617-555-0199 |
| 10 | Northline Printing Co | Toronto | Canada | 2020-06-12 | Business | 416-555-0133 |
| 11 | Daniel Kim | Seattle | USA | 2024-10-03 | Consumer | NULL |
| 12 | Westbrook Dental Clinic | Chicago | USA | 2022-12-01 | Business | 312-555-0164 |
Got it? You just filtered rows with WHERE. The lesson on SQL WHERE explains how the condition is evaluated and which mistakes trip up most beginners.
What the course covers
There are six levels. Each one ends with a project: a bigger task from everyday office work where you write several queries in a row and put the pieces together.
- Level 1: Getting started. Tables, rows and columns, SELECT, WHERE, AND and OR, IN, BETWEEN, LIKE, missing values with NULL, ORDER BY, DISTINCT and calculated columns. Project: customer list.
- Level 2: Summarizing data. COUNT, SUM, AVG, MIN and MAX, groups with GROUP BY and HAVING, CASE WHEN, string and date functions. Project: sales report.
- Level 3: Joining tables. JOIN and LEFT JOIN, queries across several tables, self joins, UNION, subqueries and EXISTS. Project: order overview.
- Level 4: Changing data and building tables. INSERT, UPDATE and DELETE, CREATE TABLE and ALTER TABLE, primary and foreign keys, views and transactions. Project: inventory.
- Level 5: Advanced queries. WITH (CTEs), rankings with window functions, running totals, LAG and LEAD, pivoting with CASE WHEN and finding duplicates. Project: customer analysis.
- Level 6: Real work and final test. The order in which a database runs your query, SQL for Excel users and the differences between MySQL, PostgreSQL and SQL Server. Project: monthly report, followed by the final test.
Your learning path
Lessons build on each other, but you can open any of them directly. With a free account your solved exercises are saved, and the check marks show your progress on every device.
-
Level 1: Getting started
-
Level 2: Summarizing data
-
Level 3: Joining tables
-
Level 4: Changing data and building tables
-
Level 5: Advanced queries
-
Level 6: Real work and final test
-
Bonus: Database design
-
Bonus: Performance
-
Bonus: Recursive queries and upserts
Start with lesson 1 Create a free account
How practicing in the browser works
Every exercise runs against a real SQL database (SQLite), not a mock-up that only accepts one spelling. Type your query and run it as often as you like. Each run starts from a fresh copy of the data, so even a DELETE without WHERE does no lasting harm. It just shows you why nobody does that at work.
Check compares the result of your query with the task: columns, rows and values. What counts is the output, not whether your query matches the model answer word for word. Your query then runs again on different, hidden data, so copying a result or typing in a fixed value gets caught. When something is off, the message says what: an extra column, the wrong sort order, a missing quote or a misspelled column name.
Hints come in three steps, from the idea to an almost finished query, and the solution only appears when you ask for it. Everything runs in your browser, on a phone as well. There is no need to install MySQL or anything else.
Who the course is for
- Complete beginners: you have never touched a database. Level 1 starts with what a table actually is.
- Office, finance and sales roles: you want to pull lists and numbers from your CRM, ERP or accounting system yourself instead of waiting for someone to send an export.
- Excel users: you know filters, VLOOKUP and PivotTables. In SQL the same ideas are called WHERE, JOIN and GROUP BY.
- Job seekers: the job ad asks for SQL and you want to list it honestly and back it up in an interview.
- Students: you need SQL for a class, a capstone project or your first internship with data.
Online SQL course or instructor-led class?
A live SQL class, in person or on a video call, has one big advantage: you can ask questions right away. But a one or two day class ends, and skills you do not use afterwards fade quickly. This course works the other way round. You learn at your own pace in short sessions of usually 10 to 20 minutes and write every query yourself. That also makes it a good warm-up before a class or a place to keep practicing after one.
Courses for your field
Once the core path is done, you can apply SQL to cases from your own line of work. Each course has six case studies and its own certificate.
- SQL for data analysis: KPIs, funnels, ABC analysis, time series, cohorts and data quality checks.
- SQL for finance: budget vs actual, contribution margin, accounts receivable aging, cost centers, cash flow and month-end close.
- SQL for marketing: channels, campaigns, retention, RFM segments, basket analysis and customer lifetime value.
See all of them on the SQL intensive courses page.
Final test and certificate
The core path ends with a timed final test made of hands-on tasks, with no hints and no solutions. Just like in the exercises, every query is also checked against hidden data. Pass it and you get a LearnThisNext certificate with your name, the date and a verification link. It comes from LearnThisNext and is not an Oracle or Microsoft certification. What it shows, and which vendor exams exist, is explained on the SQL certification page.
What the course costs
Every lesson is free to read. All of level 1, including its exercises and project, is free, and from level 2 on the first exercise of each lesson is free too. Premium unlocks every other exercise, the projects from level 2 on, the final test with certificate and all exercises in the courses for your field. One Premium plan covers every subject on LearnThisNext, today Excel, SQL, VBA and Power BI. Current prices are on the pricing page.
SQL training for teams
Companies, public agencies, schools and nonprofits can buy team seats: pick the number of seats, share one join link, and everyone learns with their own account and their own progress. We do not run on-site classes with a trainer.
Frequently asked questions
Is the SQL course free?
Partly. All explanations are free, and so is the whole of level 1 with every exercise and the project. From level 2 on, the first exercise of each lesson is free and the rest is part of Premium.
How long does the course take?
A lesson usually takes 10 to 20 minutes. How fast you get through all six levels depends on how often you practice. Short, regular sessions work better than one long day.
Do I need any experience?
No. The course starts from zero. It helps if you have worked with tables before, for example in Excel, but it is not required.
Will I learn MySQL, PostgreSQL or SQL Server?
You learn SQL, the language all of them understand. The exercises run on SQLite, and what you write here works the same or almost the same in the other systems. Where they differ, the lesson says so.
Can I learn on my phone?
Yes. You can tap table and column names instead of typing them. For longer queries and the projects, a computer is more comfortable.
I already know some SQL. Do I have to start at level 1?
No. Open any lesson directly. If you solve its exercises right away, you are done in a few minutes and can move on.