Almost every app you use stores information in a database. SQL is how you ask it questions.
Direct answer
SQL (Structured Query Language) is the standard language for working with relational databases, which store data in tables of rows and columns. With a few commands you can read data (SELECT), filter it (WHERE), summarise it (GROUP BY) and combine tables (JOIN).
A table
A database table looks like a spreadsheet:
| id | film | seats_sold | price |
|---|---|---|---|
| 1 | Starlight | 120 | 9 |
| 2 | Moonrise | 80 | 8 |
| 3 | Sunset | 150 | 9 |
Core commands
Read everything
SELECT * FROM shows;
Pick columns and filter
SELECT film, seats_sold
FROM shows
WHERE seats_sold > 100;
Sort
SELECT film FROM shows ORDER BY seats_sold DESC;
Summarise
SELECT price, SUM(seats_sold) AS total_seats
FROM shows
GROUP BY price;
Combine two tables
SELECT customers.name, bookings.seat
FROM bookings
JOIN customers ON customers.id = bookings.customer_id;
Change data
INSERT INTO shows (film, seats_sold, price) VALUES ('Aurora', 0, 9);
UPDATE shows SET price = 10 WHERE film = 'Moonrise';
Always use WHERE with UPDATE and DELETE, or you'll change every row.
Where SQL is used
- Apps and websites
- Business reports and dashboards
- Finance, health, logistics
- Data analysis. See how to become a data scientist.
Different database systems
SQLite, MySQL, PostgreSQL and SQL Server differ slightly, but the core is the same.
Next steps
Learn in order with how to learn SQL for beginners, practise with SQL practice for beginners.
Where Teyro fits
Teyro's SQL and Databases for Beginners runs real SQLite in your browser: you query a cinema's booking database in every lesson. It is free to start.
The bottom line
SQL is a short list of ideas that cover most of what you'll do. Learn them by running them.



