Tutorial for PostgreSQLs
The tutorial stage is where PostgreSQL work starts: installing the server, connecting with psql, creating databases and tables, and using SQL to insert, query, update and delete rows. It introduces SELECT with WHERE, ORDER BY, joins, aggregates and GROUP BY, which make up most everyday queries.
Stage: SQL in PostgreSQL · Part of the PostgreSQL roadmap · Last reviewed 19 November 2026
What to learn in Tutorial
- Connect with psql and create a database and a table
- Insert, update and delete rows with proper WHERE clauses
- Join two tables with INNER and LEFT JOIN
- Summarise data using GROUP BY, HAVING and aggregate functions
- Add primary keys, foreign keys and constraints to protect data
Tutorial interview questions
What is the difference between WHERE and HAVING in PostgreSQL?
WHERE filters individual rows before grouping, while HAVING filters groups after aggregation. For example, WHERE removes cancelled orders first, and HAVING keeps only customers whose summed total exceeds a threshold. Aggregates cannot appear in WHERE.
What does a foreign key constraint enforce?
It guarantees that a value in one table matches an existing key in another, so you cannot create an order for a customer who does not exist. ON DELETE options decide what happens to child rows when the parent is removed.
Where Tutorial fits in the PostgreSQL roadmap
Tutorial belongs to the SQL in PostgreSQL stage (beginner level), which takes about 23 hours. Tutorial and language.
Other units in this stage
Back to the full PostgreSQL roadmap