📈 Analytics

ROW_NUMBER, LAG/LEAD, running totals and PIVOT: reporting without leaving SQL.

Snippet
☆ROW_NUMBER by Dept — Number rows within each partition
☆LAG / LEAD — Access previous/next row values without a self join
☆FIRST_VALUE — Highest-paid employee name repeated per dept
☆Running Total — Cumulative sum down the rows
☆PIVOT — Rows to columns
☆UNPIVOT — Columns to rows
☆NTILE Quartiles — Bucket rows into quartiles

← Back to all categories