Learn to Code
All tracks
Learn to Code

Free lessons from scratch to pro — every language, databases and DevOps.

AboutContactPrivacy PolicyTerms of Use

Your progress is saved in this browser. © 2026 Learn to Code

SQL
SQL
0/12 completed
Beginner
What is a database?SELECT: reading dataFiltering with WHERESorting and limiting results
Intermediate
Aggregates and GROUP BYJOINs: combining tablesINSERT, UPDATE and DELETECreating tables and constraints
Advanced
Subqueries and CTEsWindow functions
Pro
Indexes and transactionsDatabase design and normalization
Tracks / SQL / Beginner

What is a database?

A database is an organised store of data that many programs and users can read and change safely. Almost every app you use (banking, shopping, social media) is a user interface on top of a database.

A relational database stores data in tables, much like spreadsheets:

  • A table holds one kind of thing: customers, products, orders.
  • Each row is one record: one customer.
  • Each column is one attribute: name, email, city.
  • A primary key (usually id) uniquely identifies each row.

SQL (Structured Query Language, pronounced "S-Q-L" or "sequel") is the language for talking to relational databases. The same SQL works, with small differences, in PostgreSQL, MySQL, SQLite, SQL Server and Oracle.

Meet the sample database

Every editor in this track runs on a real SQLite database inside your browser. It's a tiny online shop with three tables:

Table Columns
customers id, name, email, city, joined
products id, name, category, price, stock
orders id, customer_id, product_id, quantity, order_date

orders.customer_id points to customers.id, and orders.product_id points to products.id. These links are called foreign keys, and they're what make the database relational.

Press ▶ Run to see all customers:

SQL · editable

Now try the other tables:

SQL · editable
SQL · editable

Each editor has its own copy of the database. You can't break anything; press Reset to start fresh.

SQL vs NoSQL

Relational (SQL) NoSQL (e.g. MongoDB, Redis)
Shape Tables with a fixed schema Documents, key-value pairs, graphs
Relationships Strong, via JOINs Usually embedded or handled in code
Best for Business data, transactions, reporting Flexible or huge-scale data, caching

Most companies use both. SQL is the one every developer is expected to know.

The four things you do with data (CRUD)

Action SQL command
Create INSERT
Read SELECT
Update UPDATE
Delete DELETE

You'll learn all of them in this track, starting with SELECT.

✎ Check your understanding

1.In a table, what does one row represent?

2.What is orders.customer_id an example of?