Business Analysis / Learning brief

Sam smooths a daily count and finds the latest task

What this means in plain language

Sam builds a moving average, a day-to-day change and a latest-task query.

Understand the full idea, step by step

Analogy: a moving spotlight. On a stage, a spotlight lights the dancer in front and the two behind. As the dance moves, the spotlight moves, but the stage does not change.

The lit group is the frame.

A frame clause sets how many rows are lit. Sam, an analyst at Daily List, a to-do list app, uses it for a three-day average.

Evidence & review

REVIEWED 2026-10-31

The date on this lesson is when it went up on Payments Signal, not when its material was written — most of these were brought across from an earlier catalogue in a single run, which is why so many of them share a date. What the lesson says about the world is dated by the review above and by the sources below it.

Window frames, lag and lead, and top N. The people, app and data are invented.

What this brief simplifies: Fiction labelled SYNTHETIC / TRAINING ONLY. Sources were seen only as search excerpts. Tools and screens change, and each team sets its own.

Sources for this brief — 3 sources
  1. Market practice

    Window Functions (PostgreSQL tutorial) ↗ — PostgreSQL Global Development Group · PostgreSQL tutorial: partition by splits rows into groups, order by sets the order inside each group, and with an order the default frame runs from the start of the group to the current row plus any ties (search excerpt, page not opened)

    §3.5 window placement, partition/order/frame. PostgreSQL18 implementation, not a universal SQL mandate. · Checked 2026-11-06

    PostgreSQL18 publisher documentation opened on6November2026: §3.5 window placement, partition/order/frame. No execution on PostgreSQL is claimed; engine-specific examples remain scoped to18.

  2. Market practice

    Window functions reference (PostgreSQL documentation) ↗ — PostgreSQL · PostgreSQL reference: lag looks back and lead looks forward by an offset that defaults to one, and a window function cannot be used in where so a top N filter needs a subquery (search excerpt, page not opened)

    The PostgreSQL reference for ranking and offset functions such as lag, lead and row number. Official project documentation. · Checked 2026-10-31

    Found through a web search; the page was not opened (search excerpt, page not opened). Version: Web page, no edition number. Licence terms were not read, so put it in your own words and do not quote it. Open the page and confirm what it says before relying on any detail.

  3. Simplified educational illustration

    Payments Signal editorial teaching models — Payments Signal

    This site's own simplified teaching models. · Checked 2026-07-12

    Used wherever diagrams, scenarios, figures, or example values are didactic constructions rather than sourced facts; every such use carries a simplifications disclosure. All people, companies, banks, and list entries in examples are fictional.

Learn this properly

START HEREWindow functions in depth: frames, lag and lead, and top N per groupGo past ranking. Learn what a frame of rows is, how to compare a row with the one before it, and how to keep the top few rows in each group.Opens at L0 Explain simply · about 15 min

Related briefs