SQL Window Function Explainer
Run ROW_NUMBER, RANK, DENSE_RANK, LAG, LEAD, and running aggregates on a live sample dataset partitioned by department, and see exactly how each function behaves — including tie handling.
Tool interface
Result
Ready.
SQL syntax
Introduction
Window functions compute values across a set of rows without collapsing them. This explainer runs them on real sample data so you can see tie handling, gaps, and running totals in action.
Limitations
- Uses a fixed sample dataset to illustrate behavior.
- Vendor-specific frame clauses (ROWS/RANGE) are not covered.
FAQ
What is the difference between RANK and DENSE_RANK?
Both give tied rows the same rank. RANK then skips the next number(s); DENSE_RANK does not.