ShareYourGroupShareYourGroupSQL

Learn SQL step by step, and run it in your browser

Short lessons in plain words. Every example shows its real result, and one tap opens it in a practice box where you can change it and run it. Exercises check your answer. No login, nothing to install.

Start lesson 1 Open the practice box

Reading data

Summaries

More than one table

Changing data and tables

Going further

How this course works

SQL is the language of databases, and the only way to learn it is to write it. So every lesson here is built around a small practice database, a made-up shop with customers, products, orders and staff, and everything you read can be run.

  1. Read a lesson. Each one covers a single idea, such as WHERE or GROUP BY, with examples and their real results.
  2. Press Try it under an example. The query opens in the practice box. Change a word or a number, press Run, and see what happens. You cannot break anything. One button puts the database back as new.
  3. Do the exercises. Each lesson ends with three. Write your query in the practice box and press Check my answer. The box compares your rows with ours and tells you whether they match.
  4. Mark the lesson as done. A tick appears beside it on this page. The ticks are kept in your own browser.

The lessons are in order, and each uses only what came before. If you are new, start at lesson 1. If you know some SQL, the list below shows where to jump in.

What you will be able to do

That covers what is asked of most people who use SQL at work: analysts, accountants who report from a database, testers, support staff and new developers. The page of interview questions gathers the questions that come up again and again.

What you need

A browser. The practice box runs a real database engine, SQLite, inside the page. Your queries do not leave your phone or computer. It works on a phone, though a keyboard makes longer queries easier.

Which database is this for?

All of them. The core of SQL is the same in MySQL, PostgreSQL, SQL Server, Oracle and SQLite. Where they differ, for example in how to take the first ten rows or how to work with dates, the lesson shows each form, and the page on SQL in different databases puts the differences in one place.

Questions people ask

Is SQL hard to learn?

It is one of the easier computer languages. A query reads almost like an English sentence, and you can do useful things after the first three lessons. Joins and grouping take some practice. Most people are comfortable with the first eighteen lessons within two or three weeks of short daily sessions.

Do I need to know programming first?

No. SQL is not like a general programming language. You describe the result you want, and the database works out how to get it. Many people who use SQL every day never learn another language.

Is SQL still worth learning?

Yes. It has been the standard way to work with data for about fifty years and is still the most widely requested data skill. Spreadsheets run out of room. Databases do not, and SQL is how you talk to them.

Can I use the practice box for my own tables?

Yes. You can create tables and insert rows of your own, as lessons 19 to 22 show. They live in your browser tab until you press Reset or close the page.

This is an independent learning site. It is not connected with the makers of any database product. MySQL, PostgreSQL, SQL Server, Oracle and SQLite are named only so that you know where a piece of SQL works. The shop, its customers and its staff in the practice database are made up.