PostgreSQL from the ground up: model, query and index data

Install PostgreSQL, design tables with keys and constraints, write joins, aggregates and window functions, and add indexes that help

7 ratings 3,680 students Sample

Created by Irina Sokolova

  • Updated September 2026
  • English
  • Beginner

What you will learn

  • Install PostgreSQL and work confidently in psql
  • Design tables with appropriate data types, keys and constraints
  • Write joins, aggregates, CTEs and window functions
  • Insert, update and delete data safely inside transactions
  • Use upserts with ON CONFLICT and RETURNING clauses
  • Read EXPLAIN output and create useful indexes
  • Manage roles and back up databases with pg_dump

Course content

6 sections, 24 lessons, 3h 44m total

Getting started with PostgreSQL 5 lessons · 44 min
  • Video: Why PostgreSQL Preview 8 min
  • Article: Installing PostgreSQL and connecting with psql Preview 10 min
  • Article: Databases, schemas, tables and types 11 min
  • Article: Your first queries: SELECT, WHERE, ORDER BY 10 min
  • Quiz: Check your understanding 5 min
Designing tables that protect data 4 lessons · 39 min
  • Article: Primary keys 9 min
  • Article: Foreign keys and relationships 11 min
  • Article: NOT NULL, UNIQUE and CHECK constraints 9 min
  • Article: Building the full bookshop schema 10 min
Querying across tables 4 lessons · 43 min
  • Article: Joins 12 min
  • Article: Aggregates and GROUP BY 10 min
  • Article: Subqueries and common table expressions 10 min
  • Article: Window functions 11 min
Changing data safely 3 lessons · 28 min
  • Article: INSERT, UPDATE and DELETE with RETURNING 9 min
  • Article: Transactions 11 min
  • Article: Upserts with ON CONFLICT 8 min
Indexes and performance basics 4 lessons · 37 min
  • Article: How B-tree indexes work 10 min
  • Article: Reading EXPLAIN and EXPLAIN ANALYZE 11 min
  • Article: Composite and partial indexes 9 min
  • Article: When not to add an index 7 min
Running PostgreSQL 4 lessons · 33 min
  • Article: Roles and permissions 9 min
  • Article: Backups with pg_dump and restore 9 min
  • Article: JSONB where it fits 9 min
  • Quiz: Final check 6 min

Requirements

  • Basic command line skills
  • A computer that can run PostgreSQL or Docker

Description

PostgreSQL is one of the most widely used databases in the world, trusted by startups and large companies alike for its reliability, standards compliance and rich feature set. This course teaches you to use it properly, from your first connection to designing schemas, writing real queries and understanding indexes.

What you will build

We model and query the database for a small online bookshop: customers, books, authors, orders and order items. Every concept is applied to this schema, so you see how pieces fit together in a realistic system.

  • Install PostgreSQL locally or with Docker, and connect with psql
  • Create tables with sensible data types, primary keys and foreign keys
  • Protect data with NOT NULL, UNIQUE and CHECK constraints
  • Write joins, aggregates, subqueries, common table expressions and window functions
  • Change data safely with transactions, RETURNING and upserts
  • Read query plans with EXPLAIN and add indexes that actually help
  • Manage roles, take backups and use JSONB where it fits

Version and tools

Examples are tested on PostgreSQL 17 and 18, and nearly everything works on older supported versions too. You can run PostgreSQL with Docker or a native installer. We use the psql command line client throughout, and you can also use a graphical tool such as pgAdmin or DBeaver if you prefer.

Who it is for

Developers who use databases through an ORM and want to understand what happens underneath, analysts moving beyond spreadsheets, and students learning SQL. No database experience is required, though basic comfort with the command line helps.

Who this course is for

  • Developers who want to understand the database beneath their ORM
  • Analysts and data learners starting with SQL
  • Students taking database or backend courses

Instructor

Irina Sokolova

Database engineer teaching PostgreSQL, data modelling and query performance

  • 4.3 instructor rating
  • 21 reviews
  • 6,990 students
  • 3 courses
  • Sample

I work as a database engineer, mostly with PostgreSQL. My job covers schema design, migrations, indexing, query tuning, backups and helping application developers understand why their queries are slow.

I teach databases as a practical engineering skill. We model real domains, write SQL by hand, read EXPLAIN output together and break things on purpose so you can see how constraints and transactions protect your data. I explain the theory, such as normal forms and isolation levels, only as far as it changes what you do.

All examples run on a local PostgreSQL install or a Docker container, and every course includes the scripts so you can reproduce each step.

View profile

Student reviews

4.3 7 ratings
5 star 43%
4 star 43%
3 star 14%
2 star 0%
1 star 0%
Joseph N. Sep 24, 2026
Sample

Great for analysts too

I came from spreadsheets and now write my own queries with window functions for monthly reports.

Sophie T. Sep 12, 2026
Sample

Finally understand what my ORM does

I have used PostgreSQL through an ORM for years. Writing joins and reading EXPLAIN myself changed how I design features.

Kofi M. Jul 20, 2026
Sample

Excellent constraint lessons

Letting the database reject bad data was a revelation. We added CHECK constraints to production the following week.

Anna L. May 28, 2026
Sample

Clear and well structured

The bookshop schema made everything concrete. Window functions were explained better than anywhere else I have looked.

Ravi K. Apr 1, 2026
Sample

Good intro to indexes

The EXPLAIN lesson was very practical. I would welcome a follow up on query tuning, which I see exists.

Marta G. Feb 10, 2026
Sample

Docker step needed adjusting

The volume path differed for my older image, but the note in the lesson pointed me in the right direction.

Lina F. Dec 2, 2025
Sample

Psql tips are handy

I avoided the command line before. Now psql with timing on is my default tool.

$69.99 Enroll now
SampleSample catalog: the instructors, courses, reviews and stats on this site are demo content.