Postgres by Example
Summary
A hands-on introduction to PostgreSQL using annotated SQL examples, covering basics to advanced topics.
View Cached Full Text
Cached at: 06/10/26, 05:45 PM
boringcollege/postgres-by-example
Source: https://github.com/boringcollege/postgres-by-example
Postgres by Example
PostgreSQL is a powerful, open-source relational database. Please read the official documentation to learn more.
Postgres by Example is a hands-on introduction to PostgreSQL using annotated SQL examples. Check out the first example or browse the full list below.
Prerequisites: PostgreSQL installed and the server running. Examples assume you can connect with psql; the default database is postgres unless noted. Start the server with your system’s service manager or pg_ctl start as needed.
Unless stated otherwise, examples target current stable PostgreSQL. Use the latest version you can if something isn’t working.
Table of Contents
Getting Started
Querying
Data Types
DDL
- CREATE TABLE
- Column Types and Constraints
- ALTER TABLE and DROP
- Primary Keys and Unique
- NOT NULL and DEFAULT
DML
Joins and Sets
Aggregation and Grouping
Subqueries
Functions and Operators
Indexes
Transactions
Views
Security
Extras
Licensed under CC BY 4.0.
by Dariush Abbasi | source
Similar Articles
PostgreSQL 19 Interactive Tour
This article provides an interactive guide to new features in PostgreSQL 19 beta, focusing on SQL/PGQ for property graph queries with hands-on examples.
The startup's Postgres survival guide
A comprehensive guide for startups running PostgreSQL in production, covering schema design, query optimization, indexes, migrations, connection management, and advanced topics like query planning and partitioning.
PostgreSQL for Everything
This article argues that PostgreSQL is a versatile database solution capable of replacing multiple specialized technologies such as search engines, message queues, and caches, thereby simplifying IT setups.
@0xlelouch_: 90% of PostgreSQL in 2026 comes down to mastering these 10 concepts: 1) MVCC + vacuum. Old row versions stick around; a…
The article lists ten essential PostgreSQL concepts to master in 2026 for efficient database management, covering MVCC, indexing, query optimization, and security.
Reading the internals of Postgres: Database cluster, databases, and tables
A technical article exploring PostgreSQL internals, covering the logical and physical structure of database clusters, databases, tables, system catalogs, and object identifiers (OIDs).