Why SQL & Why It Endures
Beginner · 14 min read · ▶ live playground · ✦ checkpoint
Every app you've ever used — the food delivery order, the bank balance, the playlist, the message thread — is a thin layer of buttons over a database, and the language that database speaks is SQL. This lesson explains what a database actually is, shows you the single idea that makes SQL unlike other programming languages, and lets you run your first real query against a live database sitting right here in your browser.
Your data needs a home
Imagine building a café's ordering app with no database — just files. Every order appends a line to orders.txt. It works for a week. Then the questions start: what did we sell the most of last month? Now you're writing code to read the whole file, split every line, parse the numbers, group things up. Two customers order at the same instant and their lines interleave into garbage. The laptop dies mid-write and half an order survives. You invent indexes, locking, and crash recovery, badly, one bug at a time.
A database is what you get when someone solves all of those problems once, properly, so every app doesn't have to: a program whose whole job is to store data safely, answer questions about it fast, and survive concurrent users and pulled power cords. The databases this course teaches — PostgreSQL, MySQL, SQLite, and their relatives — organize data into tables (next lesson's subject) and take their questions in SQL: Structured Query Language.
You describe the result, not the steps
Here's the idea that makes SQL feel alien at first and indispensable forever. In most languages you write how to compute something — loop over the orders, check each one, add to a running total. SQL is declarative: you describe what you want, and the database figures out how to get it.
The question "how many menu items does each category have, and what's the cheapest?" is a dozen lines of loops and dictionaries in Python or JavaScript. In SQL, it's the question itself, barely rephrased:
Press Run. That result grid came from a real PostgreSQL database — the same engine that runs at Instagram, Reddit, and half the startups you've heard of — loaded with a small café menu and running entirely in your browser. Don't worry about understanding the query yet; by Section 4 you'll write it without thinking. Notice what you didn't write: no loop, no counter, no "open the file". You declared the shape of the answer, and the engine chose the steps.
That division of labor is the course's quiet superpower. Because you only state what, the database is free to change how — use an index, rewrite your query, parallelize it — without you touching a line. Decades of optimizer engineering work for you on every query. Much later, in Section 16, you'll open the hood and watch it decide.
Fifty years old and everywhere
SQL was designed at IBM in the mid-1970s, built on Edgar Codd's 1970 relational model. In software terms it isn't old — it's geological. And yet: it outlived the object databases of the '90s, the XML databases of the 2000s, and most of the "NoSQL will replace SQL" wave of the 2010s — whose survivors, tellingly, grew SQL-like query languages of their own, while a new generation of "NewSQL" systems put full SQL on top of distributed storage. Meanwhile the language keeps growing: the current standard, SQL:2023, added a native JSON type and graph-query syntax.
Who actually uses SQL
Nearly everyone who touches data, which is nearly everyone:
- Backend developers — every API endpoint that shows or saves anything ends in a query.
- Data analysts & scientists — SQL is the first interview round and the daily driver; the fancy models start with a
SELECT. - Data engineers — the pipelines that move a company's data are, to a first approximation, SQL with scheduling.
- PMs, founders, support, finance — the self-serve dashboard is a query someone wrote; the people who can write their own stop waiting in line.
That breadth is the practical reason SQL consistently ranks among the most-used languages in developer surveys, decade after decade: it's not competing with Python or JavaScript — it sits underneath them.
Where this course takes you
A tour of what you'll be able to do, in the order you'll learn it. Read data with precision — filter, sort, and aggregate your way to answers (Part I, ending with a 15-question detective case). Combine tables with joins and write data safely (Part II). Design databases — schemas, constraints, transactions — well enough to trust one with money (Part III). Use the power tools: window functions, recursive queries, JSON, and the optimizer itself (Part IV). Apply it in the real world of analytics, application code, and AI assistants (Part V), then go under the hood (Part VI). Every lesson runs against a live database, and every part ends with you building something.
One more thing before the tour starts: SQL is the language, not the program. PostgreSQL, MySQL, SQLite — those are databases that speak SQL, each with an accent. The next lesson draws that map properly, starting with the big idea they all share: the table.
Checkpoint
Answer all three to mark this lesson complete