Free lesson · What a Database Is, and Your First Query

Who this course is for, and how to read it

This course assumes you have never written a line of SQL. Not "you did a tutorial once and forgot it" — genuinely nothing. If you have written queries before and want the layer underneath, you want SQL & Database Design: Beyond the Basics instead; this one will feel slow.

How the lessons are built

Every idea arrives in the same three steps, deliberately:

  1. The problem. What question can you not yet answer? Syntax you cannot attach to a problem is syntax you will forget by Thursday.
  2. How the database goes about it. The mental model — what the database is actually doing with your rows. This is the part most tutorials skip, and it is the part that makes the rules stop feeling arbitrary.
  3. The syntax. Last, and shortest.

You are not expected to memorise syntax. Working developers look up the exact spelling of things constantly. What you are expected to carry away is the model: once you can predict how many rows a query returns before you run it, the spelling is a search away.

You will need to type things

Reading SQL is not learning SQL. Every lesson has queries in it, and you should run them — then change them and run them again. Break them on purpose. A query that fails and tells you why teaches more in ten seconds than a paragraph of prose.

Keep a scratch file open. When something works, paste it in with a one-line note about what it does. By section 10 you will have a personal reference worth more than any cheat sheet, because you wrote it.

What this course covers, and what it does not

By the end you will be able to answer real questions about real data: filter, sort, summarise, combine tables, change rows safely, and create tables of your own. That is the everyday work.

What it deliberately leaves out: performance tuning, query plans, indexing strategy, isolation levels, and schema design at scale. Those matter, and they are the follow-on course. Trying to learn them now would mean learning them badly.

This is one lesson of 54

SQL Foundations: Your First Queries, Explained Properly continues from here — 4 lessons are free to read like this one, and the rest come with the course. Enrolled readers also get an AI tutor that has read the lesson they are on.

See the full course

Every free lesson in this course