PostgreSQL Tutorial
Learn PostgreSQL with practical SQL examples and guides for querying data, designing tables, choosing data types, creating indexes, and administering a database.
As of September 28, 2026, PostgreSQL 18 is the latest stable major release. PostgreSQL 19 Beta 4 is available for testing, but the PostgreSQL project says beta and release-candidate builds are not intended for production. Check the official PostgreSQL beta status before trying a pre-release version.
PostgreSQL 14 reaches end of support on November 12, 2026. If you run PostgreSQL 14, see the upgrade guide from PostgreSQL 14 to 18 and rehearse the migration before the support date.
Start with PostgreSQL basics for SELECT, joins, filters, and data changes, or choose a topic from the guide list below.
If a query fails, use the PostgreSQL error troubleshooting index to find help by SQLSTATE. For local diagnostic tools, visit SQL and database tools. To size application pools against max_connections and reserved slots, use the PostgreSQL connection budget calculator.
For an existing PostgreSQL 17 cluster, see how to upgrade PostgreSQL 17 to 18; installing PostgreSQL 18 packages alone does not migrate the old cluster’s data.
-
PostgreSQL Basics
- PostgreSQL SELECT
- PostgreSQL WHERE
- PostgreSQL ORDER BY
- PostgreSQL FETCH
- PostgreSQL LIMIT
- PostgreSQL OFFSET
- PostgreSQL DISTINCT
- PostgreSQL Column Alias
- PostgreSQL Table Alias
- PostgreSQL IN
- PostgreSQL BETWEEN
- PostgreSQL LIKE
- PostgreSQL IS NULL
- PostgreSQL EXISTS
- PostgreSQL ALL
- PostgreSQL ANY
- PostgreSQL GROUP BY
- PostgreSQL HAVING
- PostgreSQL GROUPING SETS
- PostgreSQL ROLLUP
- PostgreSQL CUBE
- PostgreSQL JOIN
- PostgreSQL Subqueries
- PostgreSQL CTE
- PostgreSQL UNION
- PostgreSQL INTERSECT
- PostgreSQL EXCEPT
- PostgreSQL INSERT
- UPSERT: ON CONFLICT
- PostgreSQL UPDATE
- PostgreSQL UPDATE...FROM
- PostgreSQL RETURNING OLD and NEW
- PostgreSQL DELETE
- PostgreSQL TRUNCATE
- PostgreSQL CASE
-
PostgreSQL Databases and Tables
- PostgreSQL Create Databases
- PostgreSQL Drop Databases
- PostgreSQL Alter Databases
- PostgreSQL Rename Databases
- PostgreSQL Create Tables
- PostgreSQL Drop Tables
- PostgreSQL Alter tables
- PostgreSQL Rename Tables
- PostgreSQL Add Columns
- PostgreSQL Rename Columns
- PostgreSQL Primary Keys
- PostgreSQL FOREIGN KEY
- PostgreSQL NOT NULL
- PostgreSQL UNIQUE
- PostgreSQL Generated Columns
- PostgreSQL Identity Columns
- Temporal Constraints (PostgreSQL 18)
- PostgreSQL CHECK
- SERIAL
- PostgreSQL SEQUENCE
- PostgreSQL SELECT INTO
- PostgreSQL Schema
-
PostgreSQL Data Types Overview
-
PostgreSQL Administration
-
PostgreSQL Indexes
-
Error Troubleshooting