SQL
BasicAdvancedQuery and change relational data with SQL that really runs — from SELECT and joins to window functions, query plans and transactions.
7
modules
22
lessons
22
runnable exercises
Sign in to begin →Sign in, then straight into the first lesson.
Course contents
01Querying dataBasic
Tables, rows and keys
What a relational database actually stores, and why it stores it that way.
Foreign keys: one fact, one place
Why each fact belongs in one table, and how a foreign key points at it.
SELECT and WHERE
Read columns from a table and filter to the rows you want.
Sorting, DISTINCT and LIMIT
Order the result, remove duplicates, and take only the rows you need.
02Shaping resultsBasic
Expressions, functions and CASE
Compute new values in the SELECT list instead of storing them.
Working with NULL
Three-valued logic, and the functions that tame it.
Aggregation
Summarise many rows into counts, sums and averages.
03Combining tablesBasic
JOINs
Combine rows from two tables on a shared key.
Outer joins and self joins
Keep the rows that did not match, and join a table to itself.
UNION, INTERSECT and EXCEPT
Stack and compare whole result sets rather than joining columns.
04SubqueriesBasic
Subqueries
Use the result of one query inside another.
EXISTS and correlated subqueries
Subqueries that run per row, and the NOT IN trap that eats results.
05Changing dataBasic
Data types
What kind of value each column holds, and what SQLite does when a value does not fit.
Creating tables and constraints
Types, keys and the rules the database enforces so your code does not have to.
INSERT, UPDATE and DELETE
Add, change and remove rows — and the WHERE clause that decides how many.
Transactions
Group statements so they all happen, or none of them do.
06Performance and designAdvanced
Indexes and query plans
Why the same query can be instant or slow, and how to see which.
Isolation and concurrency
What happens when two transactions touch the same rows at once.
Normalisation and schema design
Organising tables so that a fact is stored exactly once.
07Reusable and analytic queriesAdvanced
Views
Give a query a name and treat it as a table.
Common table expressions
Name the steps of a query with WITH, and walk a hierarchy recursively.
Window functions
Aggregate across rows without collapsing them.
Ready when you are.
Opening a lesson takes an account. Nothing to install.