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