Free curriculum
Learn SQL, lesson by lesson
Develop SQL query fluency in a deliberate progression: retrieve and change rows, combine relations, summarize data, design schemas, and reason about correctness and query plans.
Each stage builds on real relational operations, moving from SELECT to joins and aggregation before transactions, window functions, design, and optimization.
Complete curriculum
Work in order, or open any lesson as a public reading reference. Interactive practice remains optional.
- Read lesson →
Lesson 1 · basics
Introduction to SQL
Learn the basics of SQL and how to interact with databases using queries
- Position
- core · 15 min
- Prerequisites
- None
- Outcomes
- Syntax Fluency, Data Modeling
- Runtime / version
- The runner executes SQL against an in-memory SQLite database through Python 3.11.
- Read lesson →
Lesson 2 · basics
Selecting Data
Master the SQL SELECT statement to retrieve specific data from your database. Learn column aliases, DISTINCT, LIMIT, and expressions.
- Position
- core · 20 min
- Prerequisites
- None
- Outcomes
- Syntax Fluency
- Runtime / version
- The runner executes SQL against an in-memory SQLite database through Python 3.11.
- Read lesson →
Lesson 3 · basics
Filtering and Sorting
Learn SQL WHERE clauses and ORDER BY to filter and sort query results. Covers IN, BETWEEN, IS NULL, and LIKE for precise data retrieval.
- Position
- core · 20 min
- Prerequisites
- None
- Outcomes
- Syntax Fluency
- Runtime / version
- The runner executes SQL against an in-memory SQLite database through Python 3.11.
- Read lesson →
Lesson 4 · basics
Inserting and Updating Data
Learn SQL INSERT, UPDATE, and DELETE statements to add, modify, and remove data in your database tables safely.
- Position
- core · 20 min
- Prerequisites
- None
- Outcomes
- Syntax Fluency
- Runtime / version
- The runner executes SQL against an in-memory SQLite database through Python 3.11.
- Read lesson →
Lesson 5 · basics
Joins and Relationships
Learn how to combine data from multiple tables using JOIN statements and understand table relationships
- Position
- core · 25 min
- Prerequisites
- None
- Outcomes
- Syntax Fluency, Data Modeling
- Runtime / version
- The runner executes SQL against an in-memory SQLite database through Python 3.11.
- Read lesson →
Lesson 6 · intermediate
Aggregation and Grouping
Learn to summarize data with aggregate functions like COUNT, SUM, AVG, and GROUP BY
- Position
- core · 22 min
- Prerequisites
- Introduction to SQL, Selecting Data, Filtering and Sorting
- Outcomes
- Syntax Fluency
- Runtime / version
- The runner executes SQL against an in-memory SQLite database through Python 3.11.
- Read lesson →
Lesson 7 · intermediate
Subqueries
Learn to write queries within queries using scalar subqueries, correlated subqueries, EXISTS, and IN
- Position
- core · 25 min
- Prerequisites
- Selecting Data, Aggregation and Grouping
- Outcomes
- Abstraction & Design, Syntax Fluency
- Runtime / version
- The runner executes SQL against an in-memory SQLite database through Python 3.11.
- Read lesson →
Lesson 8 · intermediate
Indexes and Performance
Learn how SQL indexes speed up queries. Create indexes, analyze query plans with EXPLAIN, and optimize database performance.
- Position
- core · 20 min
- Prerequisites
- Selecting Data, Filtering and Sorting
- Outcomes
- Performance & Runtime
- Runtime / version
- The runner executes SQL against an in-memory SQLite database through Python 3.11.
- Read lesson →
Lesson 9 · intermediate
Views and CTEs
Learn to organize complex queries with views, Common Table Expressions, and recursive CTEs
- Position
- core · 24 min
- Prerequisites
- Joins and Relationships, Subqueries
- Outcomes
- Abstraction & Design
- Runtime / version
- The runner executes SQL against an in-memory SQLite database through Python 3.11.
- Read lesson →
Lesson 10 · intermediate
Transactions
Learn how to use transactions to ensure data consistency with BEGIN, COMMIT, ROLLBACK, and SAVEPOINT
- Position
- core · 20 min
- Prerequisites
- Inserting and Updating Data
- Outcomes
- Security & Robustness, Production Delivery
- Runtime / version
- The runner executes SQL against an in-memory SQLite database through Python 3.11.
- Read lesson →
Lesson 11 · advanced
Triggers and Automation
Learn SQL triggers to automate database actions. Create audit trails, enforce rules, and run logic on INSERT, UPDATE, and DELETE events.
- Position
- core · 22 min
- Prerequisites
- Inserting and Updating Data, Transactions
- Outcomes
- Abstraction & Design, Security & Robustness
- Runtime / version
- The runner executes SQL against an in-memory SQLite database through Python 3.11.
- Read lesson →
Lesson 12 · advanced
Window Functions
Learn to perform advanced calculations with ROW_NUMBER, RANK, PARTITION BY, LAG, LEAD, and running totals
- Position
- core · 26 min
- Prerequisites
- Aggregation and Grouping, Subqueries
- Outcomes
- Syntax Fluency, Abstraction & Design
- Runtime / version
- The runner executes SQL against an in-memory SQLite database through Python 3.11.
- Read lesson →
Lesson 13 · advanced
Database Design
Learn database design with normalization, entity-relationship modeling, primary and foreign keys, and constraints for clean schemas.
- Position
- core · 28 min
- Prerequisites
- Joins and Relationships, Inserting and Updating Data
- Outcomes
- Data Modeling
- Runtime / version
- The runner executes SQL against an in-memory SQLite database through Python 3.11.
- Read lesson →
Lesson 14 · advanced
Migrations
Learn to evolve your database schema safely with ALTER TABLE, data migrations, and strategies for backward-compatible changes.
- Position
- core · 22 min
- Prerequisites
- Inserting and Updating Data, Database Design
- Outcomes
- Production Delivery, Data Modeling
- Runtime / version
- The runner executes SQL against an in-memory SQLite database through Python 3.11.
- Read lesson →
Lesson 15 · advanced
Capstone Project
Build a complete e-commerce database with SQL. Design schemas, write complex joins, aggregations, window functions, and analytics queries.
- Position
- core · 35 min
- Prerequisites
- Joins and Relationships, Aggregation and Grouping, Window Functions
- Outcomes
- Data Modeling, Abstraction & Design, Syntax Fluency
- Runtime / version
- The runner executes SQL against an in-memory SQLite database through Python 3.11.
- Read lesson →
Lesson 16 · basics
String Functions
Master SQL string functions to clean, transform, and extract text data. Learn UPPER, LOWER, SUBSTRING, REPLACE, and TRIM.
- Position
- core · 25 min
- Prerequisites
- Introduction to SQL, Selecting Data, Filtering and Sorting
- Outcomes
- Syntax Fluency
- Runtime / version
- The runner executes SQL against an in-memory SQLite database through Python 3.11.
- Read lesson →
Lesson 17 · intermediate
Date and Time Functions
Master SQL date and time functions to query, format, and calculate temporal data. Extract date parts, compute intervals, and filter by ranges.
- Position
- core · 22 min
- Prerequisites
- Introduction to SQL, Selecting Data, Filtering and Sorting, Aggregation and Grouping, String Functions
- Outcomes
- Syntax Fluency
- Runtime / version
- The runner executes SQL against an in-memory SQLite database through Python 3.11.
- Read lesson →
Lesson 18 · basics
Null Handling
Understand how NULL works in SQL. Learn COALESCE, NULLIF, and IS NULL to write queries that handle missing data correctly.
- Position
- core · 25 min
- Prerequisites
- Introduction to SQL, Selecting Data, Filtering and Sorting, Aggregation and Grouping
- Outcomes
- Security & Robustness, Syntax Fluency
- Runtime / version
- The runner executes SQL against an in-memory SQLite database through Python 3.11.
- Read lesson →
Lesson 19 · intermediate
Set Operations
Learn SQL set operations to combine and compare result sets. Master UNION, INTERSECT, and EXCEPT for multi-query analysis.
- Position
- core · 25 min
- Prerequisites
- Introduction to SQL, Selecting Data, Filtering and Sorting, Aggregation and Grouping
- Outcomes
- Syntax Fluency
- Runtime / version
- The runner executes SQL against an in-memory SQLite database through Python 3.11.
- Read lesson →
Lesson 20 · basics
Data Types And Casting
Understand SQL data types and type casting. Learn implicit and explicit conversion with CAST to avoid errors and data loss.
- Position
- core · 25 min
- Prerequisites
- Introduction to SQL, Selecting Data, Filtering and Sorting, Aggregation and Grouping
- Outcomes
- Data Modeling, Security & Robustness
- Runtime / version
- The runner executes SQL against an in-memory SQLite database through Python 3.11.
- Read lesson →
Lesson 21 · intermediate
Constraints And Keys
Learn SQL constraints to enforce data integrity. Cover PRIMARY KEY, FOREIGN KEY, UNIQUE, NOT NULL, CHECK, and DEFAULT values.
- Position
- core · 25 min
- Prerequisites
- Introduction to SQL, Selecting Data, Filtering and Sorting, Joins and Relationships, Database Design
- Outcomes
- Data Modeling, Security & Robustness
- Runtime / version
- The runner executes SQL against an in-memory SQLite database through Python 3.11.
- Read lesson →
Lesson 22 · advanced
Recursive Queries
Learn recursive SQL queries with WITH RECURSIVE CTEs to traverse hierarchical data, generate sequences, and solve self-referencing problems.
- Position
- core · 25 min
- Prerequisites
- Introduction to SQL, Selecting Data, Filtering and Sorting, Joins and Relationships, Set Operations
- Outcomes
- Abstraction & Design, Syntax Fluency
- Runtime / version
- The runner executes SQL against an in-memory SQLite database through Python 3.11.
- Read lesson →
Lesson 23 · advanced
JSON in SQL
Learn to store and query JSON data in SQL. Use JSON functions, path expressions, and table-valued functions for semi-structured data.
- Position
- core · 25 min
- Prerequisites
- Introduction to SQL, Selecting Data, Filtering and Sorting, Aggregation and Grouping, Joins and Relationships, String Functions
- Outcomes
- Data Modeling, Syntax Fluency
- Runtime / version
- The runner executes SQL against an in-memory SQLite database through Python 3.11.
- Read lesson →
Lesson 24 · advanced
Triggers and Events
Go beyond basic SQL triggers: WHEN filters, RAISE resolutions, UPDATE OF column lists, INSTEAD OF triggers on views, and recursive triggers.
- Position
- core · 25 min
- Prerequisites
- Introduction to SQL, Views and CTEs, Transactions, Constraints And Keys, Triggers and Automation
- Outcomes
- Architecture & Maintainability, Security & Robustness
- Runtime / version
- The runner executes SQL against an in-memory SQLite database through Python 3.11.
- Read lesson →
Lesson 25 · advanced
Query Optimization
Learn SQL query optimization with execution plans, index strategies, and common performance pitfalls to make your queries faster.
- Position
- core · 28 min
- Prerequisites
- Introduction to SQL, Selecting Data, Filtering and Sorting, Joins and Relationships, Aggregation and Grouping, Indexes and Performance, Constraints And Keys
- Outcomes
- Performance & Runtime
- Runtime / version
- The runner executes SQL against an in-memory SQLite database through Python 3.11.