P-6.2 Querying With SQL
You can select, filter, sort and limit rows confidently, and explain why comparisons against a missing value behave the way they do.
SQL is declarative, which means you describe the result you want rather than the steps to produce it, and that is genuinely a different way of thinking for anyone arriving from ordinary programming. The single most common source of wrong answers is the missing value, because it is not equal to anything including itself. Learning that rule properly on the first day saves an unreasonable amount of confusion later.
Work through these
Selecting columns and filtering rows
Choosing which columns to return and which rows to keep covers a surprising share of everyday queries. Being specific about columns rather than taking all of them is a habit worth forming early.
SQLBolt: Learn SQL with interactive exercises · TutorialSorting and limiting results
Without an explicit ordering a database is free to return rows in any order it likes, and it will change its mind between runs. Any query whose output order matters must say so.
Missing values are not equal to anything, including themselves
A comparison against a missing value returns neither true nor false, so rows silently drop out of results that should contain them. There is a separate test for absence and you must use it.
Pattern matching, ranges and set membership
Filtering by a text pattern, a numeric range or a listing of accepted values covers most remaining conditions. Knowing which of these can use an index comes later and starts here.
Write ten queries against a real dataset without looking anything up
Load a dataset with a few thousand rows and answer real questions about it. Fluency here is a matter of repetition rather than understanding, and it arrives quickly.
PostgreSQL Documentation: Tutorial · Docs
Sign in to keep your progress.
Free resources
Links last checked 31 Aug 2026.
Stuck here?
Ask a mentor. A real person answers, and they can see exactly which topic you're on. Usually within a couple of working days.
Checking your session…
Topics shown in module order.