Everything useful before you download or buy.
Ranks, running totals, shares and moving averages, without losing a row.
Two A4 pages on SQL window functions, written on the datasets of the LucidPlexus books: Clearstone's budget, Lanternfield's startups, HealSync's claims and the agricultural prices. Every query was run, and its real result is printed under it.
It covers ROW_NUMBER, RANK and DENSE_RANK on ties, top N per group with QUALIFY (and without it), share of total, running totals, LAG and LEAD, moving averages, time windows with RANGE, NTILE buckets, and the same moves in pandas and a spreadsheet.
It also shows the traps that give wrong answers without an error: the default frame that counts ties together, LAST_VALUE returning the current row, and an undated price that sorts last.
PDF to print, and an HTML version to read on screen. DuckDB syntax, with notes for PostgreSQL, SQL Server and MySQL.
Check the resource before buying — a limited-page preview.
This is a limited-page preview. If it does not load, open the PDF directly.
One review per person. Submitting again updates your existing review.
Be the first to review this resource.