PostgreSQL Fundamentals
Learn PostgreSQL, the advanced open-source database trusted by banks, fintechs and fast-growing startups. Design tables, write powerful SQL, use JSON and full-text search, tune queries with indexes, secure data with roles, and connect it to real applications.
4
units
20
lessons
86
practice questions
~300
minutes
Start learning today
Create a free account, then unlock this and every other Pro course with Learnix Pro for KES 999/month.
Create free account I already have an accountOutcomes
What you'll be able to do
Install PostgreSQL and work in psql and pgAdmin
Design tables with the right data types and constraints
Write joins, aggregates, CTEs and window functions
Store and query JSON with jsonb
Speed up queries with indexes and EXPLAIN
Protect data with transactions, roles and backups
Connect PostgreSQL to Python, PHP and Django apps
How it works
Read it, see it, practise it
Each lesson explains one topic clearly, shows worked examples, checks your understanding with quick questions and ends with a practical task you complete yourself.
Clear explanations
Step-by-step lessons in plain language
23 in this course
Worked examples
Real code and examples you can copy and run
21 in this course
Quick checks
Test your understanding as you go
60 in this course
Fill the blank
Recall the key commands and syntax
20 in this course
Hands-on workspace
A practical task at the end of every lesson
20 in this course
Syllabus
Everything you'll encounter
Why PostgreSQL?
What PostgreSQL is, why companies choose it, and how it compares with MySQL and NoSQL databases.
Installing PostgreSQL, psql & pgAdmin
Install PostgreSQL on your computer (or use a free cloud database), connect with psql and pgAdmin, and create your first database.
Creating Tables & Choosing Data Types
Pick the right PostgreSQL types (identity, text, numeric, timestamptz, boolean, uuid) so your data stays accurate.
Insert, Select, Update, Delete & RETURNING
The four everyday commands, plus PostgreSQL's RETURNING clause and upserts with ON CONFLICT.
Filtering, Sorting & Pagination
WHERE with AND/OR, IN, BETWEEN, ILIKE and NULL handling, ORDER BY and LIMIT/OFFSET pagination.
Keys & Constraints: Let the Database Enforce the Rules
Primary and foreign keys, UNIQUE, CHECK and NOT NULL, plus ON DELETE behaviour.
Joining Tables
INNER, LEFT and multi-table joins to answer questions that span customers, orders, items and products.
Aggregates, GROUP BY & HAVING
Totals, counts and averages per group, filtered with HAVING, plus PostgreSQL extras like FILTER and string_agg.
Subqueries & CTEs (WITH)
Break complex questions into readable steps with subqueries and common table expressions, including recursive CTEs.
Window Functions
Rankings, running totals and comparisons with previous rows, without collapsing rows.
JSON in PostgreSQL with jsonb
Store flexible attributes in jsonb columns, query them with -> and ->> and @>, and index them with GIN.
Arrays, Enums & Generated Columns
Use PostgreSQL array columns, enum types and generated columns for cleaner schemas, and know when not to.
Full-Text Search
Build fast, relevance-ranked search with tsvector, tsquery and GIN indexes, no extra search server needed.
Indexes & EXPLAIN ANALYZE
Find out why a query is slow and fix it with the right index: B-tree, composite, partial and expression indexes.
Transactions, Isolation & Locking
Group changes so they all succeed or all fail, understand MVCC, and avoid double-spending with row locks.
Views, Functions & Triggers
Save queries as views, write SQL and PL/pgSQL functions, and keep data consistent automatically with triggers.
Roles, Permissions & Row-Level Security
Give each app and person only the access they need, and enforce per-user data access inside the database with RLS.
Backups, Restores & Maintenance
Back up with pg_dump, restore with pg_restore, automate it, and keep the database healthy with VACUUM and monitoring.
Connecting PostgreSQL to Your Apps
Use PostgreSQL from Python (psycopg), PHP/Laravel and Django safely, with parameterised queries and connection pooling.
Project: A Mobile-Money Wallet Ledger
Design and build a double-entry wallet ledger in PostgreSQL: accounts, transfers, balances and audit, the core of every fintech.
Finish the course, earn a verifiable certificate
Complete every lesson, then pass the 20-question final exam (70% to pass, unlimited retakes), to receive a Learnix certificate with a unique number anyone can verify online.