← All courses
SQL: Zero to Production
Learn SQL from the ground up: query data, create tables, and change data, then joins, aggregation, subqueries, window functions and more. Run and edit the SQL from every module right in your browser, with graded exercises in the foundation modules.
beginner
Free
sqlpostgresqldatabases
14 modules · 55 lessons
▸
0. SQL Foundations
2 lessons · 7 min
-
1
What is SQL?
3 min
-
2
How SQL runs a query
4 min
▸
1. Querying Basics
5 lessons · 22 min
-
3
SELECT: choosing columns
5 min
-
4
WHERE: keeping only the rows you want
5 min
-
5
Sorting and limiting results
5 min
-
6
NULL: the "unknown" value
4 min
-
7
CASE and changing types
3 min
▸
2. Creating Tables (DDL)
4 lessons · 18 min
-
8
Choosing column types
4 min
-
9
CREATE TABLE
4 min
-
10
Constraints: rules the data must follow
4 min
-
11
Changing tables and linking them
6 min
▸
3. Changing Data (DML)
4 lessons · 19 min
-
12
INSERT: adding rows
5 min
-
13
UPDATE: changing rows
5 min
-
14
DELETE: removing rows
4 min
-
15
UPSERT and RETURNING
5 min
▸
4. Joins & Set Operations
5 lessons · 34 min
-
16
INNER JOIN: combining rows across tables
8 min
-
17
OUTER JOIN: keeping the rows that don't match
8 min
-
18
CROSS JOIN and self-joins
6 min
-
19
Set operations: UNION, INTERSECT, EXCEPT
6 min
-
20
Join fan-out: diagnosing row-multiplication bugs
6 min
▸
5. Aggregation & Grouping
4 lessons · 24 min
-
21
Aggregate functions: COUNT, SUM, AVG and friends
6 min
-
22
GROUP BY and HAVING
6 min
-
23
GROUPING SETS, ROLLUP, CUBE
7 min
-
24
FILTER and conditional aggregation
5 min
▸
6. Subqueries & CTEs
4 lessons · 25 min
-
25
Scalar and correlated subqueries
8 min
-
26
Subqueries in SELECT/FROM/WHERE, derived tables
5 min
-
27
Common table expressions: WITH
6 min
-
28
Recursive CTEs: hierarchies and graphs
6 min
▸
7. Window Functions
5 lessons · 37 min
-
29
Window functions: OVER and PARTITION BY
7 min
-
30
Ranking: ROW_NUMBER, RANK, DENSE_RANK, NTILE
6 min
-
31
Window frames: ROWS vs RANGE
9 min
-
32
Analytic functions: LAG, LEAD, FIRST_VALUE
8 min
-
33
Practical patterns: dedup with ROW_NUMBER, top-N per group, gaps & islands
7 min
▸
8. Data Modeling
2 lessons · 13 min
-
34
ER modeling: entities, relationships, cardinality
5 min
-
35
Normalization: 1NF, 2NF, 3NF, and when to denormalize
8 min
▸
9. Views & Reusable SQL
4 lessons · 23 min
-
36
Views and materialized views
7 min
-
37
PL/pgSQL basics: going beyond plain SQL
6 min
-
38
Procedures and triggers
5 min
-
39
Error handling: RAISE and EXCEPTION blocks
5 min
▸
10. Indexes & Performance
5 lessons · 43 min
-
40
EXPLAIN ANALYZE: reading query plans
9 min
-
41
B-tree indexes
10 min
-
42
Other index types: Hash, GIN, GiST, BRIN — what each is for
9 min
-
43
Composite and partial indexes
7 min
-
44
Common performance killers: missing index, function-wrapped columns, implicit casts
8 min
▸
11. JSON, Arrays & Full-Text Search
4 lessons · 26 min
-
45
JSON and JSONB
7 min
-
46
Arrays: multiple values in one column
6 min
-
47
Full-text search: tsvector and tsquery
6 min
-
48
Extensions: pg_trgm, PostGIS, pg_stat_statements
7 min
▸
12. Transactions & Concurrency
3 lessons · 20 min
-
49
Transactions and ACID
7 min
-
50
Isolation levels
6 min
-
51
Locking and deadlocks
7 min
▸
13. Capstones
4 lessons · 24 min
-
52
Capstone: design a normalized schema
6 min
-
53
Capstone: an analytics report suite
6 min
-
54
Capstone: tune a slow query
6 min
-
55
Capstone: the database layer for an app
6 min
0 Comments