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.

25 lessonsAbout 594 minutesThe runner executes SQL against an in-memory SQLite database through Python 3.11.

Complete curriculum

Work in order, or open any lesson as a public reading reference. Interactive practice remains optional.

  1. Lesson 1 · basics

    Introduction to SQL

    Learn the basics of SQL and how to interact with databases using queries

    Read lesson →
    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.
  2. Lesson 2 · basics

    Selecting Data

    Master the SQL SELECT statement to retrieve specific data from your database. Learn column aliases, DISTINCT, LIMIT, and expressions.

    Read lesson →
    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.
  3. 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.

    Read lesson →
    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.
  4. 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.

    Read lesson →
    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.
  5. Lesson 5 · basics

    Joins and Relationships

    Learn how to combine data from multiple tables using JOIN statements and understand table relationships

    Read lesson →
    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.
  6. Lesson 6 · intermediate

    Aggregation and Grouping

    Learn to summarize data with aggregate functions like COUNT, SUM, AVG, and GROUP BY

    Read lesson →
    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.
  7. Lesson 7 · intermediate

    Subqueries

    Learn to write queries within queries using scalar subqueries, correlated subqueries, EXISTS, and IN

    Read lesson →
    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.
  8. Lesson 8 · intermediate

    Indexes and Performance

    Learn how SQL indexes speed up queries. Create indexes, analyze query plans with EXPLAIN, and optimize database performance.

    Read lesson →
    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.
  9. Lesson 9 · intermediate

    Views and CTEs

    Learn to organize complex queries with views, Common Table Expressions, and recursive CTEs

    Read lesson →
    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.
  10. Lesson 10 · intermediate

    Transactions

    Learn how to use transactions to ensure data consistency with BEGIN, COMMIT, ROLLBACK, and SAVEPOINT

    Read lesson →
    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.
  11. 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.

    Read lesson →
    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.
  12. Lesson 12 · advanced

    Window Functions

    Learn to perform advanced calculations with ROW_NUMBER, RANK, PARTITION BY, LAG, LEAD, and running totals

    Read lesson →
    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.
  13. Lesson 13 · advanced

    Database Design

    Learn database design with normalization, entity-relationship modeling, primary and foreign keys, and constraints for clean schemas.

    Read lesson →
    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.
  14. Lesson 14 · advanced

    Migrations

    Learn to evolve your database schema safely with ALTER TABLE, data migrations, and strategies for backward-compatible changes.

    Read lesson →
    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.
  15. Lesson 15 · advanced

    Capstone Project

    Build a complete e-commerce database with SQL. Design schemas, write complex joins, aggregations, window functions, and analytics queries.

    Read lesson →
    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.
  16. Lesson 16 · basics

    String Functions

    Master SQL string functions to clean, transform, and extract text data. Learn UPPER, LOWER, SUBSTRING, REPLACE, and TRIM.

    Read lesson →
    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.
  17. 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.

    Read lesson →
    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.
  18. 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.

    Read lesson →
    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.
  19. Lesson 19 · intermediate

    Set Operations

    Learn SQL set operations to combine and compare result sets. Master UNION, INTERSECT, and EXCEPT for multi-query analysis.

    Read lesson →
    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.
  20. 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.

    Read lesson →
    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.
  21. 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.

    Read lesson →
    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.
  22. Lesson 22 · advanced

    Recursive Queries

    Learn recursive SQL queries with WITH RECURSIVE CTEs to traverse hierarchical data, generate sequences, and solve self-referencing problems.

    Read lesson →
    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.
  23. 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.

    Read lesson →
    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.
  24. 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.

    Read lesson →
    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.
  25. Lesson 25 · advanced

    Query Optimization

    Learn SQL query optimization with execution plans, index strategies, and common performance pitfalls to make your queries faster.

    Read lesson →
    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.