🗃️

SQL Essential

Query a real database in your browser — every answer checked against real results.

📚 59 lessons 🧩 10 phases ▶ Runs real SQL code
Start learning →

Learn SQL by querying an actual database, not by reading about one. A real SQLite database runs in your browser (via WebAssembly) and is rebuilt fresh for every query, so you can experiment freely without breaking anything. Your answers are graded by comparing your result set against the correct one — no memorising, just real queries.

Module 1: Foundations of SQL and the Relational Model

Learn how relational databases are organized and how to write your first read-only queries against a real schema.

  1. Why SQL — the Language of Data 18 min
  2. Tables, Rows, Columns and Keys 16 min
  3. Tour the Company Database 15 min
  4. SELECT, WHERE & ORDER BY 18 min
  5. Column Expressions and Aliases 17 min
  6. LIMIT and OFFSET 16 min

Module 2: Joining Tables

Combine data from multiple tables using a variety of join strategies while preserving or discarding unmatched rows.

  1. INNER JOIN — Linking Tables 15 min
  2. LEFT JOIN — Keeping Unmatched Rows 17 min
  3. Joining More Than Two Tables 18 min
  4. Self Joins and Hierarchical Data 18 min
  5. CROSS JOIN and Cartesian Products 17 min
  6. Join Conditions and NULL Handling 18 min

Module 3: Aggregating and Summarizing Data

Roll up rows into summary statistics and group results to answer business-level questions.

  1. Aggregates — Rolling Up Data 15 min
  2. GROUP BY and HAVING 15 min
  3. COUNT(DISTINCT) and Distinct Aggregates 19 min
  4. Conditional Aggregates with CASE 19 min
  5. Grouping by Expressions 19 min

Module 4: Subqueries and Common Table Expressions

Break complex problems into reusable, readable query building blocks using subqueries and CTEs.

  1. Scalar Subqueries 18 min
  2. IN, NOT IN, EXISTS and NOT EXISTS 18 min
  3. Correlated Subqueries 19 min
  4. Simple CTEs with WITH 18 min
  5. Recursive CTEs 20 min
  6. Chaining Multiple CTEs 19 min

Module 5: Modifying Data

Master the statements that change database contents while keeping data consistent and safe.

  1. INSERT INTO Basics 18 min
  2. UPDATE and DELETE 18 min
  3. UPSERT with ON CONFLICT 18 min
  4. Transactions and ACID 18 min
  5. Foreign Keys and Referential Integrity 18 min
  6. Safe Data Modification Patterns 18 min

Module 6: Schema Design and Data Definition

Design robust tables, constraints, views, and indexes that keep data clean and queries fast.

  1. CREATE TABLE & SQLite Data Types 18 min
  2. Constraints, Primary Keys & Foreign Keys 18 min
  3. Indexes & Query Performance 18 min
  4. Creating and Using Views 19 min
  5. ALTER TABLE and Schema Migrations 19 min
  6. Normalization and Database Design 19 min

Module 7: Advanced Querying and Window Functions

Solve sophisticated analytical problems with conditional logic, functions, and window calculations.

  1. CASE Expressions 19 min
  2. String and Date Functions 19 min
  3. Window Functions Basics 19 min
  4. Ranking, Lead and Lag 19 min
  5. Pivoting with Conditional Aggregation 19 min
  6. Complex Filtering and Logic 19 min

Module 8: Reporting and Business Analysis

Transform raw query results into business-ready reports, metrics, and quality checks.

  1. Designing a Business Report 19 min
  2. Key Performance Indicators and Metrics 19 min
  3. Time-Series and Cohort Analysis 19 min
  4. Data Quality Checks with SQL 19 min
  5. Parameterizing Report Queries 19 min
  6. Preparing Results for Export 19 min

Module 9: Performance, Optimization, and Best Practices

Write efficient, secure SQL by understanding query plans, indexes, and common anti-patterns.

  1. Reading Query Plans 19 min
  2. Indexing Strategies 19 min
  3. Query Rewriting and Anti-Patterns 19 min
  4. Normalization vs. Denormalization 18 min
  5. Debugging SQL Errors 18 min
  6. Security and SQL Injection Prevention 18 min

Module 10: Capstone Project Milestones

Apply the full SQL workflow to plan, build, optimize, and present a complete company analysis project.

  1. Capstone: Plan and Requirements 20 min
  2. Capstone: Schema and Data Model 20 min
  3. Build a Company Report 22 min
  4. Capstone: Data Transformation 20 min
  5. Capstone: Iterate and Validate the Report 19 min
  6. Capstone: Optimize and Present Findings 19 min