PostgreSQL Library

PostgreSQL Tutorials

A hands-on PostgreSQL learning library — install it, learn psql, master tables, queries, joins, and aggregations, then level up to views, functions, indexes, and performance tuning. Every lesson is runnable SQL.

9 tutorials · beginner → advanced

Showing 9 tutorials

Getting StartedBeginner

Install PostgreSQL — macOS, Windows, Linux & Docker

Get PostgreSQL 16 running on any machine: Homebrew, the Windows installer, apt, or a one-line Docker container — then make your first connection.

12 minRead
Getting StartedBeginner

psql Basics — The PostgreSQL Terminal

Connect with psql and move around like a pro: \l, \c, \dt, \d, \x, running .sql files, and the meta-commands you will use every day.

10 minRead
SQL FundamentalsBeginner

Create Databases & Tables — DDL and Constraints

CREATE DATABASE, CREATE TABLE, primary and foreign keys, NOT NULL, UNIQUE, CHECK, DEFAULT — plus ALTER and DROP to evolve your schema safely.

14 minRead
SQL FundamentalsBeginner

PostgreSQL Data Types — Choosing the Right One

TEXT vs VARCHAR, INTEGER vs NUMERIC, TIMESTAMPTZ, BOOLEAN, UUID, arrays, and a first look at JSONB — with the rules for picking the right type.

14 minRead
SQL FundamentalsBeginner

INSERT, UPDATE & DELETE — Changing Data Safely

Write data with multi-row INSERT and RETURNING, update and delete with confidence (always WHERE first!), and meet upsert with ON CONFLICT.

12 minRead
Queries & JoinsBeginner

SELECT Queries — WHERE, ORDER BY, LIMIT & More

The query skills you use every single day: filtering with WHERE, pattern matching with LIKE/ILIKE, sorting, pagination, DISTINCT, and NULL gotchas.

14 minRead
Queries & JoinsBeginner

PostgreSQL Joins — INNER, LEFT, RIGHT, FULL & Self

Combine tables the right way: how each join type answers a different question, visual row-matching mental models, and multi-table join patterns.

14 minRead
Queries & JoinsBeginner

Aggregations — COUNT, SUM, GROUP BY & HAVING

Turn rows into answers: COUNT, SUM, AVG, MIN, MAX, grouping by one or more columns, HAVING vs WHERE, and FILTER for conditional counts.

12 minRead
ReferenceAll levels

PostgreSQL Cheatsheet

The whole database in one page: psql commands, DDL, CRUD, joins, aggregations, indexes, and admin snippets to copy-paste.

15 minRead