Section 1 · Foundations

What SQL is, and how to read it like a sentence

SQL (say it "sequel" or "ess-cue-el" — both are fine) is the language for asking a database questions. You describe what you want; the database figures out how to get it. That's the whole trick — you're writing a request, not a program.

Your first SQL sentence

Every clause has one job.

Tap a coloured word to see what it controls. You only need three ideas to begin.

SELECT name, price
FROM products
WHERE category = 'Coffee';

SELECT chooses the columns you want to see. Think: “which facts should appear in my answer?”

🧠A table is just a spreadsheet with rules

A database is a set of tables. Each table has named columns (like spreadsheet headers) and rows (the records). SQL lets you slice, filter, combine and summarise those rows. Here is the entire products table — this output came from the real engine, not a screenshot:

Table browser · run it and see all 8 products
the * means "every column"

Change products to customers, orders, or employees and run again to meet the other tables:

Explore the other three tables
try: customers · orders · employees

📖How to read a query out loud

You write SQL in this order, but the database runs it in a different order (that's Section 5 — the big "aha"). For now, just learn to read a query as an English sentence:

read it right-to-left-ish
SELECT name, price      -- 3. show me these columns
FROM products           -- 1. from this table
WHERE category = 'Tea'  -- 2. but only these rows
ORDER BY price;         -- 4. sorted this way

Out loud: "From products, keep only the Tea rows, then show name and price, sorted by price." Notice the numbers — your eye reads SELECT first, but the database looks at FROM and WHERE first. Prove it to yourself:

The four-clause query
edit any clause and re-run

🧩The five things almost every query is made of

ClauseJobPlain English
SELECTchoose columns"show me…"
FROMchoose the table"…out of this table…"
WHEREfilter rows"…only the rows that match…"
GROUP BYbundle rows & summarise"…rolled up per category…"
ORDER BYsort the result"…sorted like this."
Three habits that save beginners hours

💥Errors are friendly here — go make one

Misspell a column or table on purpose. The engine tells you exactly what went wrong instead of just failing. Learning to read errors is half of learning SQL:

Break it on purpose
fix "naem" → "name" and run again
🧠

Checkpoint — basics

1. What does SELECT * mean?
* is the wildcard for "all columns." Great for exploring; in real code you usually name the columns you actually need.
2. Which is the correct way to compare a text value?
Text literals go in single quotes. Bare Tea would be read as a column name; double quotes mean different things across databases — single quotes are safe.
3. In SELECT name FROM products WHERE price > 4, which clause chooses the rows?
WHERE filters rows. SELECT chooses columns, FROM chooses the table. Keep those three jobs separate in your head.
🔓 You're reading a free chapter of SQL — the first two are open.
Unlock the rest of this course with a one-time payment.
Unlock this course →
🔓 See course prices