How databases actually work, taught from absolute zero with the math behind every idea — SQL from scratch, relational theory, indexing, transactions, and a full guided tour of PostgreSQL, MySQL and NoSQL so you know exactly which database to reach for and when.
What is a database, really?
Why we don't just save everything in a text file, and the one idea every database in the world is built on.
The relational model - tables, rows and columns
Why almost every serious database organizes data into tables, and the set theory quietly sitting underneath them.
Data types and NULL: what a column is allowed to hold
Why databases force every column to have a fixed type, and the surprisingly tricky logic of "missing" data.
Setting up your first database
Installing a real database on your machine, connecting to it, and running your very first commands - the practical, hands-on lesson.
Database Foundations Quiz
8 questions
DDL: defining the structure of your data
CREATE, ALTER and DROP - the SQL commands that build and change the shape of your database, plus every constraint that keeps data honest.
DML: inserting, updating and deleting rows
INSERT, UPDATE and DELETE in depth, plus why every one of them should almost always be wrapped in a transaction.
SELECT: reading data the way you'll do it most
The anatomy of a SELECT statement, the order it actually executes in, sorting, and paging through results.
Filtering and pattern matching text
LIKE, wildcards, regular expressions, and why searching text inside a database is a different problem from searching numbers.
Set operations and built-in functions
UNION, INTERSECT and EXCEPT for combining query results, plus the string, date and NULL-handling functions you'll use in nearly every real query.
SQL Fundamentals Quiz
10 questions
Joins: the set theory behind combining tables
INNER, LEFT, RIGHT and FULL joins explained with Venn diagrams, foreign keys, and the Cartesian product they're all built from.
Aggregate functions and GROUP BY
COUNT, SUM, AVG, MIN, MAX, and how GROUP BY turns rows into summarized buckets - plus why HAVING exists and WHERE can't do its job.
Subqueries and CTEs - thinking in multiple steps
Nesting queries inside queries, and using WITH clauses to name and reuse intermediate results cleanly.
Window functions - per-row analytics without collapsing rows
RANK, ROW_NUMBER, running totals, and the OVER clause - the advanced tool that GROUP BY structurally cannot do.
Self-joins, EXISTS, and conditional aggregation
Joining a table to itself, the EXISTS/NOT EXISTS pattern, the NOT IN NULL trap, and pivoting rows into columns with CASE.
Joins & Aggregation Quiz
11 questions
ER modeling: designing tables before you build them
Entities, attributes, and relationships - how to go from a real-world idea to a set of tables, on paper, before writing any SQL.
Functional dependencies and normalization (1NF-3NF)
The precise, mathematical reason certain table designs cause update anomalies, and the normal forms that systematically fix them.
Indexes: how databases actually find things fast
The B-tree explained from scratch, why it gives O(log n) lookups, and when adding an index makes things worse, not better.
Constraints and data integrity in depth
Foreign key actions (CASCADE, RESTRICT, SET NULL), CHECK constraints revisited, and referential integrity as the schema's immune system.
Design & Normalization Quiz
9 questions
ACID and transactions: the four promises every database makes
What a transaction actually is, and the precise meaning of Atomicity, Consistency, Isolation and Durability.
Concurrency and isolation levels
Dirty reads, non-repeatable reads and phantom reads explained one at a time, and the four isolation levels that prevent (or allow) each.
Query execution and EXPLAIN: seeing what the database actually does
How a SQL query becomes a physical execution plan, reading EXPLAIN output, and the join algorithms the planner picks between.
Performance tuning, hands-on: fixing a genuinely slow query
A real slow query, diagnosed and fixed step by step using EXPLAIN, indexing, and query rewriting - tying the whole module together.
Transactions & Performance Quiz
8 questions
What is PostgreSQL, and why does it exist?
The history and philosophy behind PostgreSQL, and why it's become the default choice for so many new projects.
Installing and setting up PostgreSQL properly
A real, thorough PostgreSQL setup: installation, roles and permissions, psql, and connecting from application code.
PostgreSQL-specific features that set it apart
JSONB, arrays, full-text search, and PostGIS - the features that go beyond the standard SQL covered so far in this course.
PostgreSQL in the cloud vs self-hosted: making the real decision
Managed cloud Postgres vs running it yourself - the actual trade-offs in cost, control, and operational burden, with real provider names.
PostgreSQL Deep Dive Quiz
7 questions
What is MySQL, and why does it exist?
The history of MySQL, its relationship to MariaDB, and why it became the database behind most of the early web.
MySQL storage engines and setup
Installing MySQL/MariaDB, InnoDB vs MyISAM in depth, and the mysql command-line client.
MySQL vs PostgreSQL: an honest, practical comparison
Where the two databases genuinely differ - SQL dialect, strictness, replication, and how to actually choose between them.
MySQL/MariaDB in the cloud vs self-hosted
Managed MySQL and MariaDB providers, PlanetScale's serverless branching model, and applying the Module 6 decision framework here specifically.
MySQL & MariaDB Quiz
7 questions
Why NoSQL exists - the limits of the relational model
CAP theorem, horizontal scaling, and the real problems that pushed some systems away from strict relational tables.
The four types of NoSQL databases
Document, key-value, column-family and graph databases explained one at a time - what each is actually good at, with real examples.
MongoDB hands-on: your first document database
Installing MongoDB, the document model in practice, queries and aggregation compared directly against SQL you already know.
Redis hands-on: caching and beyond
Installing Redis, its core data structures, and the caching pattern behind almost every fast, high-traffic application.
Choosing the right database: a complete decision framework
A capstone lesson bringing together every database in this course into one practical framework, plus a worked real-world example.
NoSQL & Choosing the Right Database Quiz
8 questions
Views and materialized views
Saving a query as a reusable virtual table, the difference between a view and a materialized view, and when to reach for each.
Stored procedures, functions, and triggers
Moving logic into the database itself - reusable procedures, custom functions, and code that runs automatically on data changes.
Upserts, sequences, and generated keys
Inserting-or-updating atomically with ON CONFLICT, the race condition it prevents, and choosing between auto-increment IDs and UUIDs.
Recursive CTEs and hierarchical data, properly
A full, worked recursive CTE - org charts, category trees, and the base case/recursive case pattern explained step by step.
Classic SQL patterns: nth highest, duplicates, and gaps
The exact query patterns asked in real SQL interviews and needed in real reporting work - solved using everything from this entire course.
Advanced SQL Toolkit Quiz
9 questions
SQL syntax cheat sheet
Every core SQL statement, clause and pattern from this course in one place - DDL, DML, joins, aggregation, window functions and more - for quick reference.
PostgreSQL cheat sheet
psql meta-commands, roles and privileges, JSONB, arrays, full-text search, and connection strings - the PostgreSQL-specific reference for this course.
MySQL & MariaDB cheat sheet
The mysql command-line client, storage engines, users and hosts, and the exact syntax differences from PostgreSQL - a quick reference.
NoSQL cheat sheet: MongoDB and Redis
MongoDB CRUD and the aggregation pipeline mapped directly to SQL, plus Redis's core data structures and the cache-aside pattern - a quick reference.
Cheat Sheets Quiz
5 questions
Database Foundations Quiz
Database Foundations · 8 questions
SQL Fundamentals Quiz
SQL Fundamentals · 10 questions
Joins & Aggregation Quiz
Joins & Aggregation · 11 questions
Design & Normalization Quiz
Design & Normalization · 9 questions
Transactions & Performance Quiz
Transactions & Performance · 8 questions
PostgreSQL Deep Dive Quiz
PostgreSQL Deep Dive · 7 questions
MySQL & MariaDB Quiz
MySQL & MariaDB · 7 questions
NoSQL & Choosing the Right Database Quiz
NoSQL & Choosing the Right Database · 8 questions
Advanced SQL Toolkit Quiz
Advanced SQL Toolkit · 9 questions
Cheat Sheets Quiz
Cheat Sheets · 5 questions
SQL & Databases Final Assessment
Final assessment · 25 questions