Lesson 1.38mIntermediate10.7k students
CTEs and window functions
CTEs make a long query readable; window functions compute across related rows without collapsing them. Running totals and rankings stop being hard.
This lesson sits in SQL Essentials, part of PostgreSQL for Developers. It assumes what came before it and leads directly into the next lesson in the module.
In this lesson you will
- Break a complex query into named CTEs
- Rank and number rows within partitions
- Compute running totals and row-to-row differences
Pro tip
When you catch yourself writing a subquery inside a subquery, a CTE will make it readable.
Resources
Your notes for this lesson will appear here.