Interactive SQL course · PostgreSQL

Learn SQL by writing real queries, not watching videos.

learn2sql teaches you SQL through 65 bite-sized, hands-on exercises on a real database in your browser. Type a query, get instant feedback, and build a daily habit. It's the fastest way to go from zero to job-ready.

  • Real PostgreSQL in your browser. Nothing to install.
  • Instant feedback on every query, with hints when you're stuck
  • Streaks, points and a global leaderboard keep you coming back
  • A verifiable certificate you can add to LinkedIn
✓ No sign-up needed to start✓ No tracking cookies✓ Beginner friendly
try-it.sql · PostgreSQL
Loading editor…

This is a real database. Change the 50 to 100, or try SELECT * FROM customers.

How it works

Ten minutes a day. One idea at a time.

Every lesson is a short, focused exercise: a question about a fictional online shop called Brightcart, an editor, and a real database. You write the query that answers the question. learn2sql runs it and tells you instantly whether you got it right.

Step 1

Read a real question

“Which customers have never placed an order?” Every exercise is a question a manager, a client or an interviewer might actually ask you.

Step 2

Write and run your query

Type SQL in a proper code editor with autocomplete for table and column names. Run it as often as you like and see the result table straight away.

Step 3

Get instant feedback

We compare your result with the correct answer and tell you exactly what's off: too many rows, a missing column, the wrong order. Then you earn points and move on.

Why it works

Solves the “I watched the tutorial and forgot everything” problem

You can't learn to swim by watching swimming videos, and you can't learn SQL that way either. Video courses feel productive, but most of the time you're watching someone else type. The moment you open a real database at work, the blank editor wins.

learn2sql flips that around. You spend almost all of your time writing queries yourself. Every exercise forces you to recall the syntax, think about the data and fix your own mistakes. Learning researchers call this active recall and deliberate practice, and it's why skills learned this way stick.

Exercises are short on purpose, so you can do one on your lunch break or on the train. Small daily sessions beat a single eight-hour binge, which is why we built in a daily streak.

learn2sqlVideo coursesBooks
You write every query✓——
Instant feedback✓——
Real PostgreSQL database✓——
Nothing to install✓✓✓
Daily streaks & leaderboard✓——
Verifiable certificate✓✓—
Learn in 10-minute sessions✓——
Curriculum

From your first SELECT to window functions

65 exercises in 11 chapters, ordered so that each one builds on the last. Beginners start at chapter 1. If you already know the basics, jump straight to JOINs or window functions.

Chapter 1 · 6 exercises

SELECT basics

Read data from a table: columns, aliases, DISTINCT and simple calculations.

Chapter 2 · 7 exercises

Filtering with WHERE

Keep only the rows you need with comparisons, IN, BETWEEN, LIKE and NULL checks.

Chapter 3 · 6 exercises

Sorting and limiting

Put results in order and return the top N rows.

Chapter 4 · 6 exercises

Aggregate functions

Summarise a whole table with COUNT, SUM, AVG, MIN and MAX.

Chapter 5 · 6 exercises

GROUP BY and HAVING

Summarise per group, then filter the groups.

Chapter 6 · 7 exercises

JOINs

Combine tables: INNER, LEFT and self joins.

Chapter 7 · 6 exercises

Subqueries and CTEs

Queries inside queries, EXISTS and the WITH clause.

Chapter 8 · 5 exercises

CASE and NULL handling

Conditional logic, pivots and COALESCE.

Chapter 9 · 6 exercises

Dates and text

Concatenate, transform and measure text; extract and truncate dates.

Chapter 10 · 6 exercises

Window functions

Rankings, running totals and comparisons with previous rows.

Chapter 11 · 4 exercises

Changing data

INSERT, UPDATE, DELETE and CREATE TABLE.

Browse every exercise →
Real database, not a simulator

Practise SQL online on a real PostgreSQL database

Many “interactive” SQL courses check your answer against a text pattern or run a cut-down engine. learn2sql runs the actual PostgreSQL database engine, compiled to WebAssembly, inside your browser tab. That means real error messages, real data types and real behaviour: exactly what you'll see at work.

The practice database is Brightcart, a realistic online shop with customers in eight countries, employees and managers, products, orders and order lines. It's small enough to understand and rich enough to ask interesting questions: revenue by category, customers who never ordered, month-over-month growth, top products per category.

Because the database runs on your own device, queries come back in milliseconds and you can't break anything. Every query runs in a transaction that is rolled back afterwards, so you can practise INSERT, UPDATE and DELETE freely.

Stay motivated

Built like a game, so you actually finish

Most people who buy an online course never finish it. We designed learn2sql to make finishing the default.

🔥 Daily streaks

Solve one exercise a day to grow your streak. It's a small nudge that turns SQL practice into a habit.

⭐ Points & levels

Earn 10, 20 or 30 points per exercise depending on difficulty, and level up from Newbie to SQL Pro.

🏆 Global leaderboard

See how you rank against other learners this week and of all time. Friendly competition works.

SQL certificate

Prove it with a certificate employers can verify

Finish the course and you receive a learn2sql SQL certificate with your name and a unique verification link. Add it to the Licenses & Certifications section of your LinkedIn profile, link it on your CV, or share it with your manager.

Unlike a PDF anyone could edit, every certificate can be checked at learn2sql.com, so a recruiter knows you completed all 65 exercises yourself.

How the certificate works
Who it's for

SQL is the most useful skill nobody taught you at school

Aspiring data analysts

SQL appears in most data analyst job descriptions and is tested in technical interviews. Learn exactly what those screens cover.

Marketers & growth teams

Stop waiting days for the data team. Pull campaign, funnel and customer numbers yourself in minutes.

Product managers

Answer your own questions about users and features, and talk to engineers in their language.

Finance & operations

Go beyond Excel's row limits. Query millions of transactions and build reports that refresh themselves.

Students

Add a skill that sets your CV apart, and a certificate to back it up, before you graduate.

Developers

Brush up on JOINs, CTEs and window functions and write the query instead of ten lines of loops.

Why learn SQL now?

Every company stores its data in databases, and SQL is how you talk to them. It has been the standard for decades, and it powers modern tools like Snowflake, BigQuery, Databricks and every major BI tool. AI assistants can draft SQL, but you still need to read it, check it and know what to ask, and that is exactly what this course trains.

Better still, SQL is quick to learn compared with a full programming language. A few focused weeks of practice is enough to answer real business questions on your own.

For teams & universities

Upskill your whole team in SQL

Give analysts, marketers and operations staff a practical SQL course they will actually finish. Team plans include bulk licences, invoicing and progress reports.

Get a team quote →
FAQ

Frequently asked questions

Is learn2sql free?

Yes, you can start for free with no sign-up. The first 5 exercises need no account at all. Create a free account to save your progress and unlock 5 more. After that, a paid plan unlocks the full course, the leaderboard and the certificate. Every SQL guide on the site stays free.

Do I need to install anything?

No. learn2sql runs a real PostgreSQL database inside your browser using WebAssembly. Open a lesson and start typing queries. It works on any modern laptop, and on tablets and phones too.

I have never written code. Can I still learn SQL?

Yes. SQL is one of the friendliest languages to start with because it reads almost like English: SELECT name FROM customers WHERE country = 'Germany'. The course starts from the very first SELECT and adds one idea at a time.

How long does it take to learn SQL?

Most learners can write useful queries after a weekend. Finishing all 65 exercises takes roughly 10 to 15 hours. At 15 minutes a day, that's about six weeks.

Which SQL dialect do you teach?

We use PostgreSQL, the most popular open-source database and the one most data teams use. Over 90% of what you learn (SELECT, WHERE, JOIN, GROUP BY, window functions) works the same way in MySQL, SQL Server, BigQuery, Snowflake and SQLite. The guides point out the differences where they matter.

Will this help me pass a SQL interview?

Yes. The later chapters cover exactly what data analyst and data engineer interviews test: JOINs, GROUP BY with HAVING, subqueries, CTEs, CASE WHEN and window functions such as ROW_NUMBER and LAG.

What do I get with the certificate?

When you finish every exercise you get a certificate with a unique verification link. Anyone, such as a recruiter, can open the link to confirm it's real. You can add it to the Licenses & Certifications section of your LinkedIn profile with one click.

Can I buy learn2sql for my team or class?

Yes. We offer team and university licences with invoicing. See the For teams page or email us.

Write your first SQL query in 30 seconds

Free to start. No sign-up, no install, no credit card.

Start learning for free →