This free PostgreSQL tutorial takes you from “what is a database?” to writing SQL, designing tables, making queries fast, securing and backing up a server, connecting your apps and running PostgreSQL in the cloud. Every part explains each step in plain words, and from Part 2 on, every command and output is real.
Start with Part 1 and go in order. Each part builds on the one before, and the parts below are linked as they’re published.
Who This Series Is For
- complete beginners who have never used a database
- developers who want to learn PostgreSQL properly, not only copy queries
- anyone who works with data and wants to write their own SQL
What You Need
A Mac, a Windows 11 PC or an Ubuntu machine where you’re allowed to install software. No programming knowledge is needed until Module G, where you connect apps to PostgreSQL.
Install and Set Up PostgreSQL
Each operating system has its own step-by-step guide, linked here as it’s published:
- How to Install PostgreSQL on macOS
- How to Install PostgreSQL on Windows 11
- How to Install PostgreSQL on Ubuntu
- How to Add a Folder to PATH on macOS (zsh)
- How to Add a Folder to PATH on Windows 11
- How to Completely Uninstall PostgreSQL from macOS
- How to Completely Uninstall PostgreSQL from Windows
- How to Completely Uninstall PostgreSQL from Ubuntu
All Parts
Module A: Start Here
- Part 1: What Is PostgreSQL? Databases, Tables and SQL Explained
- Part 2: Connect with psql and Run Your First Commands
- Part 3: pgAdmin 4 for Beginners
Module B: Build the Database
- Part 4: Create a Database
- Part 5: Data Types Explained
- Part 6: Create Tables
- Part 7: Primary Keys, Foreign Keys and Constraints
- Part 8: Insert, Update and Delete Data
- Part 9: Import and Export CSV Files
Module C: Query Data
- Part 10: SELECT, WHERE, ORDER BY and LIMIT
- Part 11: LIKE, IN, BETWEEN, NULL and CASE
- Part 12: GROUP BY and Aggregate Functions
- Part 13: JOINs Explained
- Part 14: Subqueries and CTEs
- Part 15: UNION, INTERSECT and EXCEPT
- Part 16: String, Number and Conversion Functions
- Part 17: Dates, Times and Time Zones
Module D: Design and Performance
- Part 18: Database Design and Normalization
- Part 19: Views and Materialized Views
- Part 20: Indexes Explained
- Part 21: EXPLAIN and Query Performance
- Part 22: Transactions, Isolation Levels and Locks
Module E: Advanced SQL and Programming
- Part 23: Window Functions
- Part 24: Recursive Queries and LATERAL Joins
- Part 25: JSON and JSONB
- Part 26: Arrays, Enums, Ranges and Generated Columns
- Part 27: Full-Text Search
- Part 28: Functions and Stored Procedures
- Part 29: Triggers
Module F: Administration and Security
- Part 30: Users, Roles and Privileges
- Part 31: Row-Level Security
- Part 32: Configuration and Restarting the Server
- Part 33: Allow Remote Connections Securely
- Part 34: Backup and Restore
- Part 35: Automate Backups
- Part 36: VACUUM, ANALYZE and Autovacuum
- Part 37: Monitoring and Slow Queries
- Part 38: Table Partitioning
- Part 39: Streaming Replication
- Part 40: Upgrade to a New Major Version
Module G: PostgreSQL for Developers
- Part 41: Connect from C# .NET with Npgsql
- Part 42: Entity Framework Core with PostgreSQL
- Part 43: Connect from Python with psycopg
- Part 44: Connect from Node.js with node-postgres
Module H: Extensions, AI and Cloud
- Part 45: Extensions
- Part 46: Vector Search with pgvector
- Part 47: Azure Database for PostgreSQL
- Part 48: Migrate to Azure and What to Learn Next
The Practice Database
Every part works on the same made-up bookstore database, so you watch one real database grow from nothing: authors, books, customers, orders and more. All names, titles and email addresses in it are invented. If you start in the middle of the series, each part begins with a short catch-up script that rebuilds the database to that point.
More Database Series
This series is part of the Database Series. To browse every topic, see the Blog Series page.
Postgres, PostgreSQL and the Slonik Logo are trademarks or registered trademarks of the PostgreSQL Community Association of Canada, and used with their permission.

