Skip to content
SQLSimplified

Learn SQL

A structured path from your first SELECT to advanced SQL. Every lesson includes a live, in-browser database to practice against.

Beginner

Intermediate

Advanced

advanced6 min
Common Table Expressions (CTE)
Name a query with WITH so you can reference it like a temporary table and write cleaner SQL.
advanced7 min
Recursive CTEs
Use WITH RECURSIVE to walk hierarchies and sequences like org charts and numbered lists.
advanced8 min
Window Functions
Compute running totals, ranks, and per-group comparisons without collapsing rows like GROUP BY does.
advanced6 min
Indexes
Speed up lookups with database indexes — what they are, when to add them, and their trade-offs.
advanced7 min
Query Optimization
Write queries the planner can execute efficiently — read less data, use indexes, and avoid surprises.
advanced6 min
Transactions
Group multiple statements into an all-or-nothing unit with BEGIN, COMMIT, and ROLLBACK.
advanced5 min
Views
Save a query as a named, reusable virtual table with CREATE VIEW.
advanced6 min
Stored Procedures
Package reusable SQL logic on the server with parameters, branching, and transactions.
advanced6 min
Triggers
Automatically run SQL in response to INSERT, UPDATE, or DELETE events on a table.
advanced6 min
EXISTS and NOT EXISTS
Test whether a subquery returns any rows — a fast, set-based way to filter.
advanced5 min
INSERT
Add new rows to a table with INSERT INTO — single rows, multiple rows, and from a query.
advanced5 min
UPDATE
Modify existing rows in a table with UPDATE — change one column or many, for one row or millions.
advanced5 min
DELETE
Remove rows from a table with DELETE — scoped by WHERE, or wipe a table entirely.
advanced6 min
String Functions
Transform and inspect text with UPPER, LOWER, LENGTH, CONCAT, SUBSTRING, and more.
advanced6 min
Date and Time Functions
Work with dates using EXTRACT, DATE_TRUNC, intervals, and date arithmetic.
advanced6 min
Self Joins
Join a table to itself to compare rows within the same table, like employees and their managers.
advanced5 min
Cross Joins
Produce every combination of rows from two tables with CROSS JOIN.
advanced5 min
EXCEPT and INTERSECT
Compare result sets: keep rows in one but not another (EXCEPT), or only the shared rows (INTERSECT).

Search

Search lessons, functions, examples, and practice problems