SQLFree Course · Beginner → Advanced

The Complete SQL Course

Learn SQL from your first query to professional database engineering. Build strong relational models, write analytical queries, protect data with transactions and permissions, tune performance, and complete portfolio-ready projects using PostgreSQL.

All 6 phases available
48
Modules
6
Phases
56h+
Of reading

Phase 1 · SQL Foundations

Understand relational databases, set up PostgreSQL, retrieve rows, filter safely, reason about NULL, sort results, and complete your first exploration project.

Module 1 Available

Databases, SQL & Your First Query

Understand relational databases and SQL, connect to PostgreSQL, and retrieve your first result set with SELECT.

~40 min6 topicsStart
Module 2 Available

PostgreSQL Setup, psql & the Course Dataset

Install or connect to PostgreSQL, navigate psql, load the course dataset, and build a repeatable query workspace.

~44 min6 topicsStart
Module 3 Available

Tables, Rows, Columns & Data Types

Develop a precise mental model for relations, rows, attributes, domains, and the data types that protect meaning.

~48 min6 topicsStart
Module 4 Available

SELECT Lists, Aliases & Expressions

Choose output columns deliberately, calculate derived values, assign readable aliases, and understand expression evaluation.

~48 min6 topicsStart
Module 5 Available

Filtering with WHERE & Boolean Logic

Filter rows with comparisons, ranges, pattern matching, membership tests, and correctly grouped Boolean conditions.

~52 min6 topicsStart
Module 6 Available

NULL & Three-Valued Logic

Reason correctly about missing and unknown values using IS NULL, COALESCE, and SQL's three-valued logic.

~50 min6 topicsStart
Module 7 Available

ORDER BY, LIMIT & Reliable Pagination

Produce deterministic result order, control NULL placement, return top rows, and compare offset with keyset pagination.

~52 min6 topicsStart
Module 8 Available

Phase Project: Explore a Bookstore Database

Combine foundational SELECT skills to answer a structured set of bookstore questions and present reproducible findings.

~85 min6 topicsStart

Phase 2 · Defining & Changing Data

Create schemas and constrained tables, insert and modify rows safely, use core functions, and build a clean data-management workflow.

Module 9 Available

Schemas, CREATE TABLE & Type Design

Create namespaces and tables with meaningful names, precise PostgreSQL types, defaults, identity columns, and timestamps.

~58 min6 topicsStart
Module 10 Available

Keys, Constraints & Referential Integrity

Protect identity and invariants with primary, unique, foreign, check, and not-null constraints.

~62 min6 topicsStart
Module 11 Available

INSERT, Generated Values & Bulk Loading

Insert single and multiple rows, retrieve generated values, handle conflicts deliberately, and load data in bulk.

~56 min6 topicsStart
Module 12 Available

UPDATE & Safe State Changes

Modify rows with precise predicates, computed assignments, joins, returning clauses, and verification-first habits.

~56 min6 topicsStart
Module 13 Available

DELETE, TRUNCATE & Data-Loss Safety

Remove data with explicit scope, understand cascades and TRUNCATE, and use transactions and backups to reduce irreversible mistakes.

~54 min6 topicsStart
Module 14 Available

String, Numeric & Date-Time Functions

Clean, calculate, and summarize values with portable core functions and PostgreSQL date-time capabilities.

~62 min6 topicsStart
Module 15 Available

CASE, COALESCE, NULLIF & Type Conversion

Express conditional business logic, supply fallbacks, prevent invalid arithmetic, and convert values explicitly.

~56 min6 topicsStart
Module 16 Available

Phase Project: Build a Clean Inventory Schema

Design, create, populate, validate, and safely modify a constrained inventory database from a written specification.

~95 min6 topicsStart

Phase 3 · Relationships & Reporting

Model normalized relationships, master every major join, aggregate business measures, compose subqueries and set operations, and deliver a reporting project.

Module 17 Available

Relational Modeling & Normalization

Translate business concepts into entities and relationships, identify dependencies, and normalize designs without losing useful context.

~64 min6 topicsStart
Module 18 Available

INNER JOIN & Matching Relationships

Join related tables with explicit predicates, qualified columns, and cardinality awareness.

~58 min6 topicsStart
Module 19 Available

LEFT, RIGHT, FULL, CROSS & SELF JOIN

Choose outer, cross, and self joins to preserve unmatched rows, generate combinations, and traverse same-table relationships.

~66 min6 topicsStart
Module 20 Available

Multi-Table Joins & Duplicate Control

Compose larger join graphs, predict result grain, diagnose accidental multiplication, and avoid DISTINCT as a blind repair.

~64 min6 topicsStart
Module 21 Available

Aggregate Functions, GROUP BY & HAVING

Calculate counts, totals, averages, and conditional measures at a clearly defined grouping grain.

~62 min6 topicsStart
Module 22 Available

Subqueries, EXISTS & Correlated Logic

Use scalar, table, and correlated subqueries while choosing EXISTS, IN, joins, or aggregation by semantics.

~68 min6 topicsStart
Module 23 Available

UNION, INTERSECT & EXCEPT

Combine compatible result sets and reason about duplicate elimination, ALL variants, column alignment, and final ordering.

~56 min6 topicsStart
Module 24 Available

Phase Project: Sales Reporting Database

Model customers, products, orders, and payments, then deliver a tested reporting pack for business stakeholders.

~105 min6 topicsStart

Phase 4 · Advanced Querying & Analytics

Use CTEs, recursive queries, window functions, advanced grouping, views, JSON, arrays, and lateral joins to solve complex analytical problems.

Module 25 Available

Common Table Expressions & Query Decomposition

Use WITH queries to name intermediate results, stage transformations, and improve reasoning while understanding planner behavior.

~64 min6 topicsStart
Module 26 Available

Recursive CTEs & Hierarchical Data

Traverse trees and graphs with anchor and recursive terms, track depth and paths, and prevent cycles.

~72 min6 topicsStart
Module 27 Available

Window Functions: Ranking & Partitions

Calculate ranks, row numbers, percentiles, and partition-level measures without collapsing detail rows.

~68 min6 topicsStart
Module 28 Available

Window Frames, Running Totals & Time Analysis

Control ROWS and RANGE frames to build running totals, moving averages, deltas, and period comparisons correctly.

~74 min6 topicsStart
Module 29 Available

GROUPING SETS, ROLLUP & CUBE

Generate multiple aggregation levels in one query and distinguish subtotal NULLs from stored NULL values.

~62 min6 topicsStart
Module 30 Available

Views, Materialized Views & Stable Interfaces

Encapsulate query contracts with views, precompute expensive reads with materialized views, and manage refresh and security tradeoffs.

~62 min6 topicsStart
Module 31 Available

JSON, Arrays & LATERAL Queries

Work with semi-structured PostgreSQL values, expand nested data, aggregate JSON, and use LATERAL for per-row dependent queries.

~74 min6 topicsStart
Module 32 Available

Phase Project: Analytical Dashboard Queries

Build a reusable analytical query layer with trends, rankings, cohorts, subtotals, JSON responses, and documented metric definitions.

~115 min6 topicsStart

Phase 5 · Performance, Transactions & Security

Design useful indexes, read execution plans, tune queries, control concurrency, apply least privilege, evolve schemas, and harden a production workload.

Module 33 Available

Index Fundamentals & B-Tree Design

Understand index structure and cost, then design single, composite, covering, expression, and partial indexes from workload.

~70 min6 topicsStart
Module 34 Available

EXPLAIN, ANALYZE & Planner Statistics

Read PostgreSQL execution plans, compare estimates with actuals, identify scans and join algorithms, and improve statistics.

~76 min6 topicsStart
Module 35 Available

Query Optimization & Sargability

Make predicates index-friendly, reduce work early, optimize joins and sorts, and verify improvements with repeatable measurements.

~72 min6 topicsStart
Module 36 Available

Transactions, ACID & Savepoints

Group changes atomically, understand ACID guarantees, recover with savepoints, and keep transaction boundaries intentional.

~68 min6 topicsStart
Module 37 Available

Isolation, Locks & Concurrency Control

Reason about concurrent anomalies, isolation levels, MVCC, row locks, deadlocks, and safe retry boundaries.

~80 min6 topicsStart
Module 38 Available

Roles, Privileges & Row-Level Security

Apply least privilege with roles, ownership, grants, default privileges, schemas, and row-level security policies.

~72 min6 topicsStart
Module 39 Available

Migrations & Zero-Downtime Schema Evolution

Treat schema changes as versioned releases and use expand-contract techniques to stay compatible during rolling deployments.

~72 min6 topicsStart
Module 40 Available

Phase Project: Tune & Secure a Transactional System

Diagnose a realistic workload, add evidence-based indexes, repair transaction races, and implement least-privilege access.

~125 min6 topicsStart

Phase 6 · Professional Database Engineering

Add database programmability, search, partitioning, data pipelines, backup and monitoring, application integration, warehousing, and a complete capstone.

Module 41 Available

Stored Functions, Procedures & Triggers

Use server-side programmability selectively for data-local operations, while controlling volatility, side effects, recursion, and deployment complexity.

~74 min6 topicsStart
Module 42 Available

Full-Text Search

Build language-aware search with tsvector, tsquery, ranking, highlighting, and GIN indexes.

~72 min6 topicsStart
Module 43 Available

Table Partitioning & Data Lifecycle

Partition large tables by range, list, or hash, enable pruning, manage local indexes, and automate retention safely.

~78 min6 topicsStart
Module 44 Available

Import, Export, ETL & Data Quality

Move data through staging tables, validate and transform it set-wise, reconcile results, and make pipelines idempotent.

~74 min6 topicsStart
Module 45 Available

Backup, Restore, Monitoring & Maintenance

Plan logical and physical recovery, test restores, monitor workload health, and understand vacuum, analyze, bloat, and routine operations.

~84 min6 topicsStart
Module 46 Available

SQL from Applications & Prepared Statements

Integrate SQL safely from application code with parameters, connection pools, transaction ownership, result mapping, and observability.

~70 min6 topicsStart
Module 47 Available

Data Warehousing & Dimensional Modeling

Design facts, dimensions, grain, surrogate keys, slowly changing dimensions, and incremental analytical loads.

~82 min6 topicsStart
Module 48 Available

Capstone: Commerce Database & Analytics Portfolio

Design, build, secure, tune, operate, and present a complete commerce database with transactional and analytical workloads.

~150 min6 topicsStart