Advanced SQL
Advanced SQL Lessons
Browse every advanced SQL topic, organized into 9 practical learning paths.
Subqueries
scalar, correlated, EXISTS, IN vs EXISTS
- Writing Subqueries in SQL
- SQL Subquery Basics
- SQL Scalar Subquery
- SQL Single-Row Subquery
- SQL Multi-Row Subquery
CTEs
WITH, chained CTEs, recursive CTEs
Window Functions
OVER, PARTITION BY, ROW_NUMBER, LAG/LEAD
- SQL Window Functions
- Understanding SQL Windows
- SQL OVER Clause
- SQL PARTITION BY
- SQL ORDER BY in a Window Function
Analytical Patterns & Business Metrics
churn, retention, cohorts, DAU/MAU
Interview Patterns
duplicates, gaps & islands, anti-joins
- SQL Find Duplicate Rows
- SQL Remove Duplicate Rows
- SQL Second Highest Value
- SQL Nth Highest Value
- SQL Latest Row per Customer
Statistical & Analytical SQL
median, percentiles, stddev, correlation
Query Performance
EXPLAIN, indexes, scan types
Views & Materialized Views
views vs materialized views
Transactions
BEGIN, COMMIT, ROLLBACK, SAVEPOINT