Business Analysis / Learning brief

The second-latest date

What this means in plain language

Nina asks Sam for the second-latest due date and a list of tasks saved twice. Sam breaks each question into two steps. A short story about subqueries and named steps in Structured Query Language (SQL).

Understand the full idea, step by step

Some questions have two steps hidden inside them.

This brief follows an analyst who is asked for the second-latest date and for tasks saved twice, and who answers each by breaking it in two.

What matters is writing the steps in plain words first, then in Structured Query Language (SQL).

Evidence & review

REVIEWED 2026-10-18

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.

Subqueries and common table expressions as taught in this academy. The app, the data and the people are invented.

What this brief simplifies: Fiction labelled SYNTHETIC / TRAINING ONLY. Real tables hold millions of rows and need a look at the query plan.

Sources for this brief — 3 sources
  1. Market practice

    WITH Queries (Common Table Expressions) (PostgreSQL documentation) ↗ — PostgreSQL Global Development Group · WITH Queries (Common Table Expressions) (PostgreSQL documentation): WITH gives auxiliary statements for a larger query, with MATERIALIZED and NOT MATERIALIZED options (search excerpt, page not opened)

    §7.8 WITH, materialization, recursion and cycle detection. PostgreSQL18 implementation, not a universal SQL mandate. · Checked 2026-11-06

    PostgreSQL18 publisher documentation opened on6November2026: §7.8 WITH, materialization, recursion and cycle detection. No execution on PostgreSQL is claimed; engine-specific examples remain scoped to18.

  2. Market practice

    Subquery Expressions (PostgreSQL documentation) ↗ — PostgreSQL Global Development Group · Subquery Expressions (PostgreSQL documentation): EXISTS, IN and ANY, and the rule that IN can give null and not false (search excerpt, page not opened)

    §9.24 EXISTS/IN/NOT IN NULL semantics. PostgreSQL18 implementation, not a universal SQL mandate. · Checked 2026-11-06

    PostgreSQL18 publisher documentation opened on6November2026: §9.24 EXISTS/IN/NOT IN NULL semantics. No execution on PostgreSQL is claimed; engine-specific examples remain scoped to18.

  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 HERESQL for BAs: subqueries and common table expressionsAnswer two-step questions in SQL, such as the second-highest value or duplicate rows, with a query inside a query or with named steps, and know which to pick.Opens at L0 Explain simply · about 15 min

Related briefs

A three, as big as a due date

Daily List needs to size a new story. The team compares it with one they already know instead of guessing hours. A small story about suitcases, cards and a velocity that nearly became a target.

READ BRIEF

The date with no time

Daily List sends due dates to a calendar that wants a time, and Lily's events land at midnight. Sam writes the mapping rule and finds more gaps. A short story about translators.

READ BRIEF