Your Cart
Loading

Advanced Window Functions: SQL Cheat Sheet (SQL Server / T-SQL)

On Sale
£2.99
Pay what you want: (minimum £2.99)
£
Added to cart

Go beyond ROW_NUMBER and running totals.


This 2-page printable cheat sheet shows you 14 window function techniques that most SQL users never learn.


Every example is ready to copy, paste and adapt to your own tables.


What’s inside:

  • Percent of total, without GROUP BY or subqueries
  • Comparing each row with its group average
  • How far each row is behind the leader
  • FIRST_VALUE and LAST_VALUE (plus the frame gotcha that catches everyone out)
  • New vs returning customers
  • Record highs, the best result so far on every row
  • Total row count while paging
  • Medians and quartiles with PERCENTILE_CONT and PERCENTILE_DISC
  • PERCENT_RANK and CUME_DIST
  • Pareto 80/20 analysis
  • Filling gaps with the last known value
  • Finding streaks with gaps and islands
  • Frame tricks: centred averages and remaining totals
  • The WINDOW clause in SQL Server 2022


Written by a working SQL developer.


Features that need SQL Server 2022 are clearly marked.


A4 PDF, ready to print, pin up or keep on screen.

You will get a PDF (189KB) file