Database Fundamentals
What databases are, how tables and keys work, and how to design data that stays correct and fast.
15 chapters
112 lessons
Start the course →
Course map
15 chapters in order. Start at the first, or jump to the one you need.
- Chapter 1 Database Basics What databases are, the kinds that exist, and how programs use them. 8 lessons
- Chapter 2 Database Tables and Keys Tables, rows, columns, data types, NULL and the keys that identify every row. 8 lessons
- Chapter 3 Database Relationships and Diagrams Link tables with foreign keys and draw the design as an ER diagram. 9 lessons
- Chapter 4 Database Queries: A First Look at SQL Read and change data with the basic SQL commands. 7 lessons
- Chapter 5 Database Normalization Remove repeated data step by step, and know when to break the rules. 8 lessons
- Chapter 6 Database Transactions and ACID Keep data correct when several things happen at once or something fails. 8 lessons
- Chapter 7 Database Indexes and Performance Make queries fast with indexes, and learn to read a query plan. 8 lessons
- Chapter 8 Database Backups and Security Protect data from loss, mistakes and attackers. 7 lessons
- Chapter 9 Choosing a Database Relational, document, key-value and more: when to use which. 7 lessons
- Chapter 10 Database Design Patterns Practical patterns for real systems: history, soft delete, audit logs, multi-tenancy and data quality. 8 lessons
- Chapter 11 Database Programming Features Triggers, stored routines, JSON, full-text search, generated columns and sequences. 8 lessons
- Chapter 12 Database Operations Run a database in production: pooling, maintenance, monitoring, high availability and ETL. 8 lessons
- Chapter 13 Database Warehousing and Analytics Analytical databases: star schemas, ETL and ELT, columnar storage, data lakes and BI. 7 lessons
- Chapter 14 Database Distributed Systems How databases spread across machines: replication, partitioning, consistency and CAP. 7 lessons
- Chapter 15 Database Design Project Design a small database from requirements to queries. 4 lessons
1. Database Basics
- Database Basics: What Is a Database Reading What data and information are, what a database is and what it promises (organised, stored for good, shared, checked, searchable), why a plain text file is not enough, and a first look at asking a real database a question in SQL. Level: basic.
- Database Spreadsheets or Databases Reading When a spreadsheet is enough and when you need a database: rules, repeated data, many tables, many users and size. A spreadsheet-style list is compared with a table that refuses bad data and with linked tables joined on a sample database you choose. Level: basic.
- Database Management Systems Reading What a database management system (DBMS) is, what it does for you (store, find, check, share, protect), the difference between a database and a DBMS, and a look at a real one, SQLite, saving and sharing data in a file. Level: basic.
- Database Kinds of Databases Reading The main families of databases (relational, document, key-value, graph) shown with the same small data in each shape, what each is good at, and why most beginners start with relational. Level: basic.
- Database Clients, Servers and Files Reading Two ways a database is run: inside your program with a file (SQLite) or as a separate server that programs connect to over a network (PostgreSQL, MySQL, MongoDB). Compared with a small working socket demo. Level: basic.
- Database How Programs Talk to Databases Reading The steps a program follows to use a database: connect, send SQL, read the rows, commit, close. Shown with Python's sqlite3, including parameters (?) that keep user input from changing the query. Level: basic.
- Database Your First Database with SQLite Reading Create a real database file, a table of books, add, read, change and delete rows, close and reopen to prove the data lasts, and look at the table's structure. A hands-on end to chapter 1. Runs on the sample database you choose. Level: basic.
- Database Glossary of Key Terms Reading A reference of about 50 essential database terms in plain words, grouped by theme (basics, structure, relationships, queries, design, transactions, speed, safety, big systems), each with the lesson that teaches it. Come back to it any time. Level: basic.
2. Database Tables and Keys
- Database Tables, Rows and Columns Reading The table is the basic building block of a relational database: columns describe what you store, rows hold one thing each, and every cell holds one value. Try it on the sample database you choose, and learn why one value per cell matters. Level: basic.
- Database Data Types Reading Every column has a data type that says what kind of values it holds: whole numbers, decimals, text, dates, true or false. See how SQLite stores them on the sample database you choose, why money needs care, and how a STRICT table enforces types. Level: basic.
- Database NULL and Missing Values Reading NULL means "no value": unknown or not applicable. It is not zero or an empty string, and it behaves oddly in comparisons (NULL = NULL is not true). Learn IS NULL, how counting and averages treat NULL, and COALESCE, on the sample database you choose. Level: intermediate.
- Database Primary Keys Reading A primary key is a column (or columns) that identifies each row exactly once. See why every table needs one, how SQLite refuses duplicates, how INTEGER PRIMARY KEY auto-numbers, and how composite keys work. Runs on the sample database you choose. Level: basic.
- Database Natural and Surrogate Keys Reading A natural key comes from real-world data (a code, an email); a surrogate key is a meaningless number the database invents. Compare them, see why changing a natural key hurts, and learn a safe default. Runs on the sample database you choose. Level: intermediate.
- Database Unique Keys and Candidate Keys Reading A UNIQUE constraint stops repeated values in a column. Learn candidate keys (every column set that could be the primary key), alternate keys, how UNIQUE treats NULL in SQLite, and unique combinations of columns. Runs on the sample database you choose. Level: intermediate.
- Database NOT NULL, DEFAULT and CHECK Reading Constraints let the database enforce your rules: NOT NULL demands a value, DEFAULT fills in a missing one, CHECK tests a condition. See each in SQLite, how to name rules, and why rules belong in the database as well as in the app. Runs on the sample database you choose. Level: intermediate.
- Database Schemas and Naming Reading The schema is the blueprint of a database: its tables, columns, types and rules. See how to read it in SQLite, change it with ALTER TABLE, and choose clear, consistent names for tables and columns. Runs on the sample database you choose. Level: intermediate.
3. Database Relationships and Diagrams
- Database Foreign Keys Reading How one table points to a row in another table with a foreign key, why this beats copying data, how to switch foreign key checking on in SQLite, and how a JOIN reads the link back. Runs on the sample database you choose. Level: basic.
- Database One-to-Many Reading The most common relationship: one parent row has many child rows. Where the foreign key goes, how to list and count children, how to move a child, and why a list in one column is the wrong design. Runs on the sample database you choose. Level: basic.
- Database One-to-One Reading A one-to-one relationship links one row to at most one row in another table. When to split a table this way, how a foreign key that is also the primary key enforces it, and what the database refuses. Runs on the sample database you choose. Level: intermediate.
- Database Many-to-Many and Junction Tables Reading When rows on both sides can link to many rows on the other, a third table holds the pairs. How a junction table works, its composite primary key, extra columns like a grade, and the queries it makes possible. Runs on the sample database you choose. Level: intermediate.
- Database Referential Integrity and ON DELETE Reading Referential integrity means every foreign key points to a real row. What happens when you delete or change a parent: refuse, cascade, or set NULL. Each rule run on the same data, and how to choose. Runs on the sample database you choose. Level: intermediate.
- Database Entities, Attributes and ER Diagrams Reading Entities are the things you store, attributes are their facts. How to draw an entity-relationship (ER) diagram in simple text, how the boxes become tables, and how to check the result in SQLite. Runs on the sample database you choose. Level: basic.
- Database Cardinality and Optionality Reading Cardinality says how many rows can link (one or many); optionality says whether a link is required or optional. How to read both on a diagram and how NOT NULL on a foreign key makes a link required. Runs on the sample database you choose. Level: intermediate.
- Database From Requirements to a Model Reading A repeatable method to turn a written description into entities, relationships and tables. Worked through a small library example, with the finished tables built in SQLite and queried to prove the design works. Runs on the sample database you choose. Level: intermediate.
- Database Trees and Self-references Reading A table can point to itself, such as an employee's manager. How a self-referencing foreign key models a tree, how to list direct reports, and how a recursive query walks the whole tree. Runs on the sample database you choose. Level: advanced.
4. Database Queries: A First Look at SQL
- Database SELECT and FROM Reading Read data with SELECT and FROM on a sample database you choose (Shop, Bank or School): all columns or some, new names with AS, calculated columns and DISTINCT. Every query runs in your browser. Level: basic.
- Database WHERE: Choosing Rows Reading Keep only the rows you want with WHERE: comparisons, AND, OR, BETWEEN, IN and LIKE, plus the NULL trap (use IS NULL, never = NULL). Runs on the sample database you choose (Shop, Bank or School). Level: basic.
- Database ORDER BY and LIMIT Reading Sort results with ORDER BY (ascending, descending, several columns) and keep only the first few rows with LIMIT and OFFSET, on the sample database you choose. Explains why row order is never guaranteed without ORDER BY. Level: basic.
- Database Aggregates and GROUP BY Reading Summarise many rows into one answer with COUNT, SUM, AVG, MIN and MAX, split the summary into groups with GROUP BY, filter groups with HAVING, and see how NULL and WHERE affect the numbers. Runs on the sample database you choose. Level: intermediate.
- Database JOIN Reading Put tables back together with JOIN on the sample database you choose: match a foreign key to a primary key with ON, join three tables, keep unmatched rows with LEFT JOIN, summarise across tables, and avoid the forgotten-ON trap. Level: intermediate.
- Database INSERT, UPDATE and DELETE Reading Change data with INSERT, UPDATE and DELETE on the sample database you choose, check how many rows changed, see the database refuse bad changes (keys, NOT NULL, CHECK), and learn why UPDATE and DELETE without WHERE are dangerous. Level: basic.
- Database Views Reading Save a query as a view, a named virtual table, on the sample database you choose. See how views hide complexity, give simple access to joined data, always show current data, usually cannot be written to, and are dropped without losing data. Level: intermediate.
5. Database Normalization
- Database Repeated Data and Anomalies Reading Why one big table with repeated facts causes trouble: update, insert and delete anomalies shown on a wide table built from the sample database you choose, and the idea behind the fix, which is to store each fact once in its own table. Level: basic.
- Database Functional Dependencies Reading What it means that one column determines another (A -> B), how to find these dependencies, how to test them with a GROUP BY query, and how they drive every normal form. Runs on the sample database you choose. Level: intermediate.
- Database First Normal Form Reading First normal form (1NF): one value per cell and no repeating columns. See how a cell holding several phone numbers breaks searching, and fix it with a second table. Runs on the sample database you choose. Level: intermediate.
- Database Second Normal Form Reading Second normal form (2NF): in a table with a composite key, no column may depend on only part of the key. See a product name repeated in order lines, break it with an update, and fix it. Runs on the sample database you choose. Level: intermediate.
- Database Third Normal Form Reading Third normal form (3NF): no non-key column may depend on another non-key column (a transitive dependency). Shown with employees and departments, with the anomalies and the split. Runs on the sample database you choose. Level: intermediate.
- Database BCNF and Beyond Reading Boyce-Codd normal form (BCNF) catches the cases 3NF misses, where a non-key column determines part of a key. Includes the trade-off of a lost dependency, and a short look at 4NF and 5NF. Runs on the sample database you choose. Level: advanced.
- Database Denormalization Reading When storing a copy of data on purpose is worth it: stored totals, history snapshots and reporting tables. Shows how a stored total drifts, how a trigger keeps it right, and rules for doing it safely. Runs on the sample database you choose. Level: advanced.
- Database Normalizing a Real Table Reading A full walk from one flat sales table to four clean tables: list the dependencies, split step by step, load the new tables with INSERT ... SELECT, and prove with joins that nothing was lost. Runs on the sample database you choose. Level: intermediate.
6. Database Transactions and ACID
- Database What a Transaction Is Reading Why some changes must happen all together or not at all, what goes wrong when a program stops halfway, and how a transaction groups several steps into one unit of work that is either completed in full or undone. Runs on the Shop, Bank or School data. Level: basic.
- Database COMMIT and ROLLBACK Reading How to end a transaction with COMMIT or ROLLBACK, what happens when a statement fails in the middle, how savepoints undo part of a transaction, and how Python's sqlite3 starts transactions for you. Runs on the Shop, Bank or School data. Level: basic.
- Database ACID: The Four Promises Reading What the four ACID promises (atomicity, consistency, isolation, durability) mean, with a small SQLite demonstration of each one, and what each promise protects you from. Atomicity and consistency run on the Shop, Bank or School data. Level: intermediate.
- Database Concurrency Problems Reading What goes wrong when several users change the same data at once: lost updates, dirty reads, non-repeatable reads and phantom reads, with a lost update reproduced in SQLite and the usual fix. Runs on the sample database you choose. Level: intermediate.
- Database Isolation Levels Reading The four standard isolation levels and which concurrency problems each one allows, what the PostgreSQL manual says about its default, and how SQLite behaves differently, shown with two connections. Runs on the sample database you choose. Level: advanced.
- Database Locks and Deadlocks Reading How databases use locks to keep transactions apart, what happens when one transaction has to wait, what a deadlock is and how it is resolved, and what SQLite does, shown with a test of two connections. Runs on the sample database you choose. Level: advanced.
- Database Optimistic and Pessimistic Control Reading Two ways to handle conflicting updates: pessimistic (lock first, then work) and optimistic (work freely, check at save time using a version number), with a working version-column example in SQLite. Runs on the sample database you choose. Level: advanced.
- Database Transactions in Application Code Reading How to use transactions safely from Python: the with-connection pattern that commits or rolls back, keeping transactions short, retrying when the database is busy, and what the pattern does not do. Runs on the sample database you choose. Level: intermediate.
7. Database Indexes and Performance
- Database Index Basics Reading What an index is (like the index at the back of a book), why a query without one must scan every row, how to see the difference with a query plan and a timing, and the trade-off an index brings. Runs on the sample database you choose. Level: basic.
- Database Index Internals Reading How an index finds rows quickly: sorted values and searching by halving, why a million rows need only about 20 steps, what an index stores, and how to see indexes in SQLite's own catalogue. Runs on the sample database you choose. Level: intermediate.
- Database CREATE INDEX and DROP INDEX Reading How to create, list and remove indexes with CREATE INDEX, CREATE UNIQUE INDEX, IF NOT EXISTS and DROP INDEX, and which indexes the database creates by itself for UNIQUE and primary keys. Runs on the sample database you choose. Level: basic.
- Database Choosing Columns to Index Reading Which columns deserve an index: those in WHERE, JOIN and ORDER BY with many different values. See why a two-value column, a calculation on the column or a leading wildcard do not help, using real query plans and timings. Runs on the sample database you choose. Level: intermediate.
- Database Composite Indexes Reading How an index on several columns works: why column order matters (the leftmost-prefix rule), how one composite index can serve several queries and sorting, and what a covering index is. Runs on the sample database you choose. Level: advanced.
- Database Query Plans (EXPLAIN) Reading How to read a query plan with EXPLAIN QUERY PLAN in SQLite: SCAN versus SEARCH, USING INDEX, COVERING INDEX, the primary key lookup, TEMP B-TREE sorting and how joins appear. Includes a checklist for slow queries. Runs on the sample database you choose. Level: advanced.
- Database Cost of Indexes Reading Why indexes slow down writes and take disk space: a measured test inserting 100,000 rows with no extra index, one index and four indexes, what else indexes cost, and how to find and drop indexes you do not need. Runs on the sample database you choose. Level: intermediate.
- Database Speed-up Tips Reading Beyond indexes: select only the columns you need, avoid the N+1 query pattern, batch writes in one transaction, page results with a keyset instead of a large OFFSET, and measure before you change anything. Runs on the sample database you choose. Level: advanced.
8. Database Backups and Security
- Database Why Backups Matter Reading How data gets lost (mistakes, bugs, hardware failure, attacks), why a copy kept next to the original is not enough, and a first backup-and-recover demo with SQLite. Runs on the sample database you choose. Level: basic.
- Database Kinds of Backup Reading Physical backups (a copy of the files) and logical backups (a text dump of SQL), full versus changed-only backups, and how to make both kinds in SQLite with the backup API and iterdump. Runs on the sample database you choose. Level: intermediate.
- Database Restoring and Testing Backups Reading A backup is only proved by a restore. Rebuild a database from a SQL dump, check it with integrity_check and a row comparison, and see what a corrupt backup looks like. Runs on the sample database you choose. Level: intermediate.
- Database Users, Roles and Permissions Reading Who may do what: authentication versus authorisation, the principle of least privilege, roles, GRANT and REVOKE in server databases, and read-only access and views in SQLite. Runs on the sample database you choose. Level: intermediate.
- Database SQL Injection Reading How building SQL by gluing user text into a string lets an attacker change the query, shown on a login check, and the fix: parameterised queries, plus least privilege and input checks. Defensive view only. Runs on the sample database you choose. Level: intermediate.
- Database Protecting Sensitive Data Reading Store only what you need, never keep passwords in plain text (salted slow hashes), mask data you display, and encrypt and limit access to backups and connections. Runs on the sample database you choose. Level: intermediate.
- Database Migrations Reading How to change a database's structure safely over time: numbered migration steps, a version number stored in the database, running them in order only once, and safe habits, shown with SQLite's user_version. Runs on the sample database you choose. Level: advanced.
9. Choosing a Database
- Database Relational Databases Reading What makes a database relational (tables, keys, SQL, rules), what it is best at (connected, exact data such as orders and accounts), and where it struggles. Includes a short SQLite demo of a join and a refused bad row. Runs on the sample database you choose. Level: basic.
- Database Document Databases Reading How a document database stores self-contained JSON-like records whose shape can vary, shown with plain Python dictionaries and JSON stored in SQLite, plus the trade-offs against tables. Level: intermediate.
- Database Key-Value Stores and Caches Reading How a key-value store keeps a value under a key for very fast lookups, how a cache uses one to avoid repeating slow work, and what you give up (no joins, no searching by value). Shown with a Python dictionary. Level: intermediate.
- Database Wide-Column and Graph Databases Reading Two specialised kinds: wide-column stores (a row key with many, varying columns, good for huge time-ordered data) and graph databases (connections are the point). Shown with a Python dictionary and a recursive SQL query. Level: advanced.
- Database OLTP and OLAP Reading Two different jobs for a database: OLTP (many small, quick reads and writes that run a business) and OLAP (big scans that analyse it). Shown with SQLite queries and a row layout versus a column layout in Python. Runs on the sample database you choose. Level: advanced.
- Database Scaling, Replication and Sharding Reading What to do when one database server is not enough: bigger machine, copies (replication) for reads and safety, and splitting data across servers (sharding). Small SQLite demos of hashing keys to shards and of a lagging replica. Level: advanced.
- Database How to Choose Reading A practical checklist for choosing a database (data shape, questions, rules, who runs it), why relational is the sensible default, and a short orientation to search, time-series, vector and NewSQL systems and to using several together. Level: intermediate.
10. Database Design Patterns
- Database Integer and UUID Primary Keys Reading Compare auto-numbered integer keys with random UUID keys on the sample database you choose: what each looks like, what leaks, what happens when two databases are merged, and how to choose. Real runs show the differences. Level: intermediate.
- Database Money, Dates and Time Zones Reading Store money without rounding errors (whole cents), store moments in time as UTC, and convert to local time only for display. Runs on the sample database you choose and shows float errors, date text and time zone conversion. Level: intermediate.
- Database Soft Delete and Archiving Reading Hide rows instead of destroying them (a deleted_at column, a view, a partial unique index) or move old rows to an archive table, on the sample database you choose. Real runs show the benefits and the traps. Level: intermediate.
- Database Audit Logs and History Tables Reading Record who changed what and when in an append-only audit table, written in the same transaction as the change, by application code or by a trigger. Real SQLite runs show both ways and how to block edits to the log. Runs on the sample database you choose. Level: intermediate.
- Database Temporal Data and Versions Reading Keep every version of a fact with valid_from and valid_to dates, ask what was true on a given day, close the old version when it changes, and detect overlapping versions. Real SQLite runs show each step. Runs on the sample database you choose. Level: advanced.
- Database Hierarchies: Paths and Nested Sets Reading Compare three ways to store a tree such as a category menu: parent links with recursive queries, stored paths, and nested sets. Real SQLite runs show subtrees, breadcrumbs and moving a branch, with the trade-offs. Runs on the sample database you choose. Level: advanced.
- Database Multi-tenant Designs Reading One application, many customers' data: compare a shared table with tenant_id, a separate database per tenant, and the leak that a missing filter or a cross-tenant link causes. Real SQLite runs include a composite foreign key fix. Runs on the sample database you choose. Level: advanced.
- Database Data Quality and Constraints Reading Build layers of defence against bad data: strict types, NOT NULL, CHECK, UNIQUE and foreign keys, plus queries that find duplicates, blanks and orphans in data you already have. Real SQLite runs show accepted and refused rows. Runs on the sample database you choose. Level: intermediate.
11. Database Programming Features
- Database Triggers Reading What a trigger is, when it fires (BEFORE, AFTER, INSTEAD OF), how OLD and NEW rows work, how to log changes and refuse bad data, and why hidden triggers can surprise you. Runs on SQLite; other systems differ. Runs on the sample database you choose. Level: intermediate.
- Database Stored Procedures and Functions Reading What a stored procedure and a stored function are, why some teams keep logic inside the database, the trade-offs, and what SQLite offers instead (routines in your application and Python functions registered with the database). Runs on the sample database you choose. Level: intermediate.
- Database Views, Materialized Views and Temporary Tables Reading A view is a saved query that always shows fresh data; a materialized view is a saved copy that is fast but can go stale until refreshed; a temporary table is a private scratch table. Runs on SQLite, with PostgreSQL's materialized views explained. Uses the sample data. Level: intermediate.
- Database JSON in Relational Databases Reading How to store JSON documents in a relational table, check that they are valid, pull values out, search inside arrays, index a JSON field and update part of a document, plus when a plain column is the better choice. Runs on SQLite. Runs on the sample database you choose. Level: intermediate.
- Database Full-text Search Reading Why LIKE is not enough for searching text, and how a full-text index works: words, AND, NOT, phrases, prefixes, column filters, ranking, highlighting and stemming. Runs on SQLite's FTS5 module; other systems have their own syntax. Runs on the sample database you choose. Level: intermediate.
- Database Generated Columns and Sequences Reading Generated columns that the database calculates for you (virtual or stored), how to index them, and sequences that hand out numbers: SQLite's INTEGER PRIMARY KEY, AUTOINCREMENT and a counter table for gap-free numbers. Runs on the sample database you choose. Level: intermediate.
- Database Events, Queues and Notifications Reading How a database can tell other programs that something changed: polling, the outbox pattern, using a table as a job queue (claim a job safely with one UPDATE ... RETURNING), and notification features such as PostgreSQL NOTIFY. Runs on the sample database you choose. Level: advanced.
- Database ORMs and Access Layers Reading What an ORM (object-relational mapper) does, where it helps and where it hurts, the N+1 query problem shown with real counts, and other ways for an application to talk to a database: raw SQL, query builders and repositories. Runs on the sample database you choose. Level: intermediate.
12. Database Operations
- Database Connections and Connection Pooling Reading What a database connection is, why opening one for every request is wasteful, how a pool lends and takes back a fixed number of connections, what happens when the pool runs dry, and how to size it. Built with a tiny pool in Python. Runs on the sample database you choose. Level: intermediate.
- Database Maintenance: Vacuum, Statistics and Reindexing Reading Why a database needs regular care: deleted rows leave empty space, statistics go stale and indexes can need rebuilding. See VACUUM, ANALYZE, REINDEX and integrity checks on a sample database you choose (Shop, Bank or School). Level: intermediate.
- Database Monitoring and Slow Queries Reading How to watch a database: what to measure, how to log queries that run longer than a limit, how to find out why they are slow with a query plan, and how to confirm the fix. A small timing wrapper in Python shows the whole loop. Runs on the sample database you choose. Level: intermediate.
- Database Capacity Planning and Storage Reading How much disk and memory will the database need next year? Measure bytes per row, see what indexes add, project growth with simple arithmetic, and plan before the disk fills up. Real SQLite measurements and a made-up projection. Runs on the sample database you choose. Level: intermediate.
- Database High Availability and Failover Reading How to keep a database running when a machine fails: availability measured in nines (computed), replicas, health checks and failover, the risk of lost writes, and a toy primary and replica in Python. Runs on the sample database you choose. Level: advanced.
- Database Disaster Recovery: RPO and RTO Reading What to do when everything goes wrong: define how much data you can lose (RPO) and how long you can be down (RTO), work both out for a made-up shop, write a recovery plan, and rehearse it. Runs on the sample database you choose. Level: advanced.
- Database Moving Data: Imports, Exports and ETL Reading How data gets into and out of a database: CSV import and export, cleaning and validating rows, rejecting bad ones with a reason, and the extract, transform, load pattern. A small import script with messy data runs in SQLite. Runs on the sample database you choose. Level: intermediate.
- Database Environments, Versions and Upgrades Reading How to change a database safely: separate development, testing and production, know your versions, record the schema version, upgrade with numbered migrations, rehearse on a copy and plan a way back. Demonstrated with SQLite user_version. Runs on the sample database you choose. Level: intermediate.
13. Database Warehousing and Analytics
- Database Operational Versus Analytical Data Reading Why the database that runs a shop and the database that answers "how did we do this quarter?" are built differently: many small reads and writes versus a few huge summaries, and why companies keep a separate analytical copy. Runs on the sample database you choose. Level: basic.
- Database Facts and Dimensions Reading The two kinds of tables in an analytical design: facts (measurable events such as sales) and dimensions (who, what, where, when). Choose the grain, build a small sales warehouse in SQLite, and keep history with a slowly changing dimension. Runs on the sample database you choose. Level: intermediate.
- Database Star and Snowflake Schemas Reading Two classic warehouse layouts: the star schema (one fact table, flat dimensions) and the snowflake (dimensions split into sub-tables). Query both, and learn roll-up, drill-down, slice and dice with real results. Runs on the sample database you choose. Level: intermediate.
- Database ETL and ELT Reading How data gets into a warehouse: extract from messy sources, transform (clean, convert, de-duplicate) and load. Compare ETL (clean in code first) with ELT (load raw, clean with SQL inside the database), with a runnable example of both. Runs on the sample database you choose. Level: intermediate.
- Database Columnar Storage Reading Row stores keep each record together; column stores keep each column together. See why reading one column from many rows is cheaper in a column layout, how repeated values compress, and the cost for single-row writes and lookups. Runs on the sample database you choose. Level: advanced.
- Database Data Lakes and Lakehouses Reading A data lake keeps raw files (CSV, JSON, logs) cheaply and decides their structure only when read ("schema on read"). Explore a small lake with Python, see its strengths and dangers, and meet the lakehouse idea that adds database features on top. Uses the sample data. Level: advanced.
- Database BI and Data Quality Reading How warehouse data reaches decision-makers (reports, dashboards, KPIs), why every metric needs one agreed definition, and how to check data quality with SQL: missing keys, orphans, impossible values and duplicates. Runs on the sample database you choose. Level: intermediate.
14. Database Distributed Systems
- Database Why Distribute Data Reading Why a database is spread over several machines (capacity, speed, availability, closeness to users), what that costs (network failures, partial failure, duplicates), and why retries need idempotent requests. Uses small simulations, not real databases. Uses the sample data. Level: intermediate.
- Database Replication Models Reading How to keep several copies of the same data: primary and replicas, synchronous or asynchronous copying, replication lag and stale reads, losing writes at failover, and the conflicts of multi-primary designs. Shown with simulations. Runs on the sample database you choose. Level: advanced.
- Database Partitioning and Sharding Strategies Reading How to split one big dataset across machines: range, hash and consistent-hash partitioning, the uneven spread and hot key problems, and why changing the number of shards moves data. Simulations, plus counts on the sample databases. Level: advanced.
- Database Consistency Models Reading What "consistent" means when data is copied across machines: strong, eventual, read-your-writes and monotonic-read guarantees, and how quorums (W + R > N) trade speed against freshness. Shown with a simulation. Runs on the sample database you choose. Level: advanced.
- Database CAP Theorem and PACELC Reading What the CAP theorem really says: during a network partition a system must choose between consistency and availability. Includes the "pick two" misunderstanding, CP and AP behaviour in a simulation, and the PACELC extension. Runs on the sample database you choose. Level: advanced.
- Database Distributed Transactions and Sagas Reading How to change data on several machines "all or nothing": the two-phase commit protocol and its blocking problem, and the saga pattern with compensating steps. Shown with simulations of success, refusal and a coordinator crash. Runs on the sample database you choose. Level: advanced.
- Database Consensus and Failure in Plain Words Reading Why machines must agree on one leader or one value even when messages are lost and nodes crash: failure detection, split brain, majority voting and terms, shown with simulations of leader election. Names Paxos and Raft without going into them. Runs on the sample database you choose. Level: advanced.
15. Database Design Project
- Database Project Requirements and Entities Reading Start a complete small design project, a tailor shop's order book: write the requirements, list the questions the database must answer, and pick the entities and attributes. This lesson is the thinking before any table is built. Level: intermediate.
- Database Project Tables, Keys and Relationships Reading Build the tailor shop database in SQLite: four tables with primary keys, foreign keys, unique, check and default rules, then load sample data and watch the database refuse five kinds of bad rows. Level: intermediate.
- Database Project Queries, Indexes and Rules Reading Finish the tailor shop project: answer the five questions with SQL joins and grouping, add a view and an index and see the query plan change, and check that deleting works the way the rules say. Level: intermediate.
- Database What to Learn Next Reading A look back at the Database Fundamentals course, a self-check of what you can now do, and the sensible next steps: practise SQL, then learn a specific database such as PostgreSQL, MySQL or MongoDB, and keep building small projects. Level: basic.