Databases & SQL
Relational and non-relational models, and the SQL clauses that actually run against them.
About this track
SQL is declarative, which is exactly why it is hard to learn: you write what you want and the engine decides how. These pages show the how. Run a join and watch rows pair up; run a GROUP BY and watch rows collapse into one.
The track covers the relational model and its NoSQL alternative, then works through the clauses in the order a query is actually evaluated, ending on window functions and CTEs.
SQL is declarative, which is exactly what makes it hard to learn: you write what you want and the engine decides how. These pages show the how - which rows survive each clause, in the order the database actually applies them.
What you will be able to do
- Write queries with confidence about which clause runs when, and why that decides where an alias is legal.
- Choose the right join, and predict how many rows come back before running it.
- Tell WHERE from HAVING by what each one filters, and pick the faster of the two.
- Explain what an index costs on write and what it saves on read.
- Say what a transaction guarantees, and what normalisation is trading away.
How the track is ordered
The relational model comes first, along with its non-relational alternative, so the later clauses have something to act on. Then SQL itself, worked through in the order a query is actually evaluated - FROM and JOIN, WHERE, GROUP BY, HAVING, SELECT, ORDER BY - which is deliberately not the order it is written in, and explains most of the errors beginners hit. Subqueries, CTEs and window functions follow, and the track ends on the engine's own concerns: indexes, transactions and normalisation. No prior database experience is needed.
Where this leads
Indexes are B-trees, and query execution order is a plan over set operations, so the algorithms track explains the machinery underneath. If you are heading toward machine learning, this is where the training data comes from and where most feature engineering actually happens.
All 42 modules, in teaching order
- 01What are Relational Databases?Interactive introduction to relational databases - primary keys, foreign keys, normalisation and the update anomalies that flat tables cause.
- 02What are Non Relational Databases?Interactive NoSQL lab - compare document, key-value, column-family and graph databases against a relational model of the same data.
- 03Datatypes in SQLInteractive SQL datatypes lab - integer ranges and overflow, CHAR vs VARCHAR storage, FLOAT vs DECIMAL precision loss, dates and NULL.
- 04DDL in SQLInteractive DDL lab - build a table with CREATE TABLE, apply ALTER, TRUNCATE and DROP, and see the effect on schema and data.
- 05Primary and Foreign Keys
- 06Constraints: UNIQUE, CHECK and NOT NULL
- 07Normalization (1NF, 2NF, 3NF) in SQLOne table with a multi-valued column, split step by step into 1NF, 2NF and 3NF. Watch the redundant cells that cause update anomalies drop to zero.
- 08DML in SQLInteractive DML lab - run INSERT, UPDATE, DELETE and SELECT against a live table, see affected rows highlighted, and practise COMMIT and ROLLBACK.
- 09Transactions and ACID in SQLStep a transfer through BEGIN, two UPDATEs and COMMIT or ROLLBACK, with a second session watching. Fail it halfway and watch atomicity undo both writes, not one.
- 10Where Clause in SQLInteractive SQL WHERE clause lab with a real predicate parser - comparisons, AND OR NOT, IN, BETWEEN, LIKE and NULL handling evaluated live.
- 11NULL Handling and COALESCE in SQLNULL is not a value, so nothing about it compares the way you expect. Pick an expression and watch COALESCE, NULLIF and IS NULL treat the same rows differently.
- 12ORDER BY in SQLWatch rows slide into their new order as you change the sort key, direction, tie-breaker and NULLS placement, with the query building live.
- 13Limit and Offset in SQLInteractive SQL LIMIT and OFFSET lab - page through results, see why ORDER BY is mandatory, and understand the cost of deep offsets.
- 14CASE and Views in SQLBuild a CASE expression that turns raw numbers into labels, then save the whole query as a view and watch it stay a live query, not a snapshot.
- 15Aggregate Functions and the NULL Trap
- 16SQL GroupBy VisualizerGroup rows by a column and watch COUNT, SUM and AVG collapse many rows into one row per group, live against a sample table.
- 17HAVING in SQLRows become groups become filtered groups. Move the same condition between WHERE and HAVING and watch the answer change, one stage at a time.
- 18Query Execution Order in SQLSQL reads top to bottom but runs FROM first and SELECT second-to-last. Step through the real order and watch the row count change at every stage.
- 19SQL Joins VisualizerWatch INNER, LEFT, RIGHT and FULL joins pull rows from two tables, and see exactly which rows each variant keeps.
- 20Self-Joins
- 21UNION, INTERSECT and EXCEPT in SQLCombine two result sets instead of two tables. Pick an operator and watch which rows survive, and see UNION ALL keep the duplicate UNION would quietly drop.
- 22Subqueries in SQLThe inner query runs first and hands its answer to the outer one. Scalar, IN-list, derived table, and a correlated subquery re-running once per row.
- 23EXISTS, IN and JOIN
- 24Common Table Expressions in SQLInteractive SQL CTE lab - see how WITH clauses turn nested subqueries into readable pipelines, and step through a recursive CTE iteration by iteration.
- 25Recursive CTEs
- 26SQL Window FunctionsRank, total and compare across rows without collapsing them, using OVER and PARTITION BY on a live result set.
- 27Regular Expressions in SQLInteractive SQL regular expression lab - test REGEXP patterns live against table rows and compare them with LIKE pattern matching.
- 28Indexes and Query PerformanceWalk a B-tree instead of reading every row and watch rows-examined collapse. Then meet the queries an index cannot help, and what it costs on writes.
- 29Composite and Covering Indexes
- 30EXPLAIN and Query Plans
- 31Isolation Levels
- 32Deadlocks
- 33MVCC: How Readers Avoid Blocking Writers
- 34Partitioning by Range and Hash
- 35Sharding
- 36Replication, Read Replicas and Lag
- 37The CAP Theorem
- 38The Document Model against Rows
- 39Key-Value and Graph Models
- 40OLTP, OLAP and Columnar Storage
- 41Star Schema: Facts and Dimensions
- 42SQL Injection and Parameterised Queries