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.

Taught byDaniel OkaforTypeScript · PostgreSQL · API design · Data modelling
8m Intermediate 10,661 students

Overview

CTEs make a long query readable; window functions compute across related rows without collapsing them. Running totals and rankings stop being hard.

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

Resources