Download presentation
Presentation is loading. Please wait.
Published byJeffrey Hicks Modified over 9 years ago
1
A Glance at the Window Functions
2
Window Functions Introduced in SQL 2005 Enhanced in SQL 2012 So-called because they operate on a defined portion of a resultset, called a Window
3
Basic syntax () OVER (PARTITION BY ORDER BY ) The partition defines the window The order by defines the order of rows within the window
4
First set of Window functions Row_Number() Rank() Dense_Rank() Ntile( )
5
PARTITION BY Category ORDER BY Points
6
Second set of Window functions Lead (Offset) Lag (Offset)
7
PARTITION BY Category ORDER BY Points
8
Aggregate Enhancements ( ) OVER (PARTITION BY ORDER BY ROWS BETWEEN AND ) Applies to Sum, Avg, Count, Min, Max
9
PARTITION BY Category ORDER BY Points ROWS BETWEEN 2 PRECEEDING AND CURRENT ROW
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.