Lesson 1.3
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.
8mIntermediate10.7k students
Overview
What this lesson covers
- Break a complex query into named CTEs
- Rank and number rows within partitions
- Compute running totals and row-to-row differences
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.
Your notes will live here soon.