Stage 1

Stage 1: Foundation

Goal: Install PostgreSQL 17, get fluent in psql, and answer real business questions from one table — filtered, sorted, typed correctly and summarised. Time: about 2 weeks at ~30–60 minutes a day (~10–12 hours including the project) · Level: absolute beginner, no database experience needed


Parts in this stage

Do them in order. Every lesson runs against shopdb, the small online store you load in Part 1 — and re-running its script resets it any time.

Part Topic You will be able to Time
1 Getting started Install PostgreSQL, drive psql, load shopdb ~1.5 h
2 Reading data Filter, sort, de-duplicate and page one table ~1.5 h
3 Types, NULL and functions Pick the right types, tame NULL, use the built-in functions ~1.5 h
4 Summarising data GROUP BY, HAVING and FILTER — many rows into answers ~1.5 h
🏁 Project: The store sales report Fifteen business questions as one commented SQL file ~3–4 h

How every part is organised

part-NN-topic/
├── README.md      ← 1. read the lesson, running every query as you go
├── examples/      ← 2. runnable .sql files for the lesson's examples (\i them)
├── exercises.md   ← 3. solve the practice questions yourself
└── solutions/     ← 4. only then compare with the solution .sql files

Every output printed in a lesson comes from a real run against PostgreSQL 17 — if your screen differs, your data drifted: psql -d shopdb -f shopdb.sql resets it.

How to study each part

  1. Open psql next to the lesson and type every query yourself — SQL enters through the fingers.
  2. Predict each result before pressing Enter; surprises are where the learning is.
  3. Do the exercises without peeking. Stuck for 15+ minutes? Read the hint, not the solution.
  4. Compare with the solution file even when yours worked — the comments explain the why.

Finish line

You are done with Stage 1 when your own report.sql matches every number in the project's self-check table. Then head to Stage 2: Intermediate.

Search the guide