Learn SQL from zero to advanced
Progress from your first query to joins, subqueries, window functions, schema design, transactions and query optimization. Learn concepts through examples and practice.
Your curriculum
38 of 38 lessons shown across 8 modules. Complete the modules in order for a progressive learning path.
Foundations
4 lessons
Introduction to SQL and Relational Databases
Understand what SQL does, how relational databases store information, and how queries answer business questions.
Relational Tables, Keys and Relationships
Model related information across tables and understand how primary and foreign keys connect records.
SQL Command Categories: DDL, DML, DQL, DCL and TCL
Classify common SQL statements by purpose and recognize which statements read, change or define database objects.
SELECT and FROM: Your First Queries
Retrieve only the columns and records needed to answer a question.
Filtering and Transforming
8 lessons
Expressions, Calculated Columns and DISTINCT
Create values in query results, name expressions and remove duplicate result rows intentionally.
WHERE and Logical Filtering
Filter records with comparisons and combine conditions without changing the underlying data.
IN, BETWEEN and LIKE Patterns
Express membership, inclusive ranges and wildcard text searches precisely.
NULL and Three-Valued Logic
Reason about missing or unknown values and avoid incorrect comparisons and NOT IN traps.
CASE: Conditional Logic in Queries
Map rows into business-defined categories and build conditional values with CASE.
String, Numeric, Conversion and Date Functions
Clean, format and transform values using common SQL functions while accounting for dialect differences.
String Aggregations: GROUP_CONCAT, STRING_AGG and Regex Patterns
Concatenate grouped records into clean delimiter-separated lists and perform advanced pattern extractions using Regex.
ORDER BY, LIMIT, OFFSET and Query Order
Sort results predictably, paginate them and understand logical query processing.
Aggregate Queries
4 lessons
Aggregate Functions: COUNT, SUM, AVG, MIN and MAX
Summarize many rows into useful measures and understand how aggregates treat NULL.
GROUP BY and HAVING
Produce grouped reports and filter groups using aggregate conditions.
Conditional Aggregation and Reporting Patterns
Build multiple metrics in one grouped query with CASE and aggregate functions.
Date & Time Analytics: Cohort Retention, Growth and Moving Windows
Master date arithmetic, Month-over-Month (MoM) growth calculations, and Day-N cohort retention matrices.
Joins and Set Operations
4 lessons
INNER JOIN: Combining Related Tables
Combine matching records using explicit join conditions and understand row multiplication.
LEFT and RIGHT OUTER JOINs
Keep unmatched records when the business question requires showing missing relationships.
Self Joins, CROSS JOINs and Three-Table Joins
Join multiple relationships, compare rows within one table and understand Cartesian products.
UNION, UNION ALL and Set Operations
Combine compatible result sets and choose the correct set operation for the database dialect.
Subqueries and CTEs
5 lessons
Scalar and Multi-Row Subqueries
Use nested queries when a query depends on a value or set returned by another query.
Correlated Subqueries and Derived Tables
Understand outer references in nested queries and use derived tables to organize calculations.
EXISTS, NOT EXISTS and Membership Pitfalls
Test whether related rows exist and choose safe anti-join patterns when NULL values are possible.
Common Table Expressions (CTEs)
Break a complex query into named steps and understand the basics of recursive CTEs.
Recursive CTEs: Hierarchical Trees, Graphs and Sequence Generation
Traverse hierarchical manager trees, product category taxonomies and generate dynamic number sequences using recursive common table expressions.
Window Functions
5 lessons
Window Functions: OVER and PARTITION BY
Calculate across related rows while retaining each row in the output.
ROW_NUMBER, RANK and DENSE_RANK
Rank rows correctly, account for ties and solve top-N-per-group interview problems.
LAG, LEAD, Running Totals and Moving Aggregates
Compare neighboring rows and calculate cumulative or moving metrics using window functions.
Window Frames, Ties and Top-N per Group
Control which rows contribute to a window calculation and choose a ranking strategy for top-N questions.
The Gaps and Islands Problem: Consecutive Streaks and Groups
Solve consecutive login streaks, contiguous date ranges and clustering problems using the ROW_NUMBER difference and flag patterns.
Schema and Data Changes
4 lessons
Data Types and CREATE TABLE
Choose sensible column types and create tables whose structure reflects the data being stored.
Constraints: PRIMARY KEY, FOREIGN KEY and More
Enforce valid and consistent data with database-level integrity rules.
INSERT, UPDATE and DELETE Safely
Create, modify and remove rows deliberately, with special care around destructive operations.
ALTER, DROP, TRUNCATE and Views
Change table structures, distinguish destructive DDL operations and expose reusable query definitions with views.
Transactions and Performance
4 lessons
Transactions, COMMIT, ROLLBACK and ACID
Group related changes into transactions and connect practical transaction commands to ACID guarantees.
Indexes and When They Help
Understand index trade-offs and identify query shapes that may benefit from indexing.
EXPLAIN and Reading Query Plans
Use execution-plan evidence to investigate a query rather than guessing which rewrite is faster.
Parameterized Queries and SQL Injection Prevention
Keep user input separate from SQL syntax and recognize unsafe dynamic query construction.