Download - T-SQL Analytic Functions
Transcript
T-SQL Analytic Functions
Kathi KellenbergerPragmatic Works
www.bidn.com/blogs/kathikellenberger
History
• Window functions introduced 2005• Window functions enhanced 2012• Analytic Functions added 2012
Window Functions
• Ranking Functions• ROW_NUMBER()• RANK()• DENSE_RANK()• NTILE()
• Partitioning• Window aggregate functions
Enhancements
• ORDER BY to window aggregate functions• Framing: Rows and Range
The Analytic Functions
• LAG() and LEAD()• FIRST_VALUE() and LAST_VALUE()• PERCENT_RANK() and CUME_DIST()• PERCENTILE_DISC() and
PERCENTILE_CONT()