Required for certification, window functions are powerful analytic functions built into SQL Server. SQL Server 2005 introduced the core window ranking functions, and SQL Server 2012 added time and statistical percentage window functions. These functions allow for advanced variable creation, and are of direct benefit to people creating features for data science. This talk will also recommend further reading on this topic.
Call Girls Bannerghatta Road Just Call 👗 7737669865 👗 Top Class Call Girl Ser...
Window functions with SQL Server 2016
1. Window Functions with
SQL Server 2016
MARK TABLADILLO
SENIOR DATA SCIENTIST, PREDICTIX/LOGICBLOX
SQL SATURDAY 439 COLUMBUS, GA – OCTOBER 2015
2. Abstract
Window functions are powerful analytic functions built into
SQL Server. SQL Server 2005 introduced the core window
ranking functions, and SQL Server 2012 added time and
statistical percentage window functions. These functions
allow for advanced variable creation, and are of direct
benefit to people creating features for data science. This
talk will also recommend further reading on this topic.
Required for Certification
3. What is a “Window”?
Answer: A set of rows defined by the OVER clause
Set One
Set Two
Set Three
ORDER BY
Set One
Set Two
Set Three
PARTITION BY
4. What is a “function”?
Function Example
Ranking ROW_NUMBER, RANK, DENSE_RANK, NTILE
Aggregate MIN, MAX, AVG, SUM, COUNT, STDEV, STDEVP, VAR, VARP
CHECKSUM_AGG, COUNT_BIG
Analytic LAG, LEAD, FIRST_VALUE, LAST_VALUE, PERCENT_RANK, PERCENTILE_CONT,
PERCENTILE_DISC, CUME_DIST
GROUP BY not required
6. What is a “Window”?
Answer: A set of rows defined by the OVER clause
Set One
Set Two
Set Three
ORDER BY
Set One
Set Two
Set Three
PARTITION BY
7. What is a “function”?
Function Example
Ranking ROW_NUMBER, RANK, DENSE_RANK, NTILE
Aggregate MIN, MAX, AVG, SUM, COUNT, STDEV, STDEVP, VAR, VARP
Analytic LAG, LEAD, FIRST_VALUE, LAST_VALUE, PERCENT_RANK, PERCENTILE_CONT,
PERCENTILE_DISC, CUME_DIST
GROUP BY not required
10. What is a “Window”?
Answer: A set of rows defined by the OVER clause
Set One
Set Two
Set Three
ORDER BY
Set One
Set Two
Set Three
PARTITION BY
11. What is a “function”?
Function Example
Ranking ROW_NUMBER, RANK, DENSE_RANK, NTILE
Aggregate MIN, MAX, AVG, SUM, COUNT, STDEV, STDEVP, VAR, VARP
Analytic LAG, LEAD, FIRST_VALUE, LAST_VALUE, PERCENT_RANK, PERCENTILE_CONT,
PERCENTILE_DISC, CUME_DIST
GROUP BY not required
12. Framing: Order Matters
Term Operators
ROWS = Physical Operator (faster) UNBOUNDED PRECEDING
UNBOUNDED FOLLOWING
N PRECEDING
N FOLLOWING
CURRENT ROW
RANGE = Logical Operator (slower) UNBOUNDED PRECEDING
UNBOUNDED FOLLOWING
CURRENT ROW (RANGE?)
17. What is a “Window”?
Answer: A set of rows defined by the OVER clause
Set One
Set Two
Set Three
ORDER BY
Set One
Set Two
Set Three
PARTITION BY
18. What is a “function”?
Function Example
Ranking ROW_NUMBER, RANK, DENSE_RANK, NTILE
Aggregate MIN, MAX, AVG, SUM, COUNT, STDEV, STDEVP, VAR, VARP
Analytic LAG, LEAD, FIRST_VALUE, LAST_VALUE, PERCENT_RANK, PERCENTILE_CONT,
PERCENTILE_DISC, CUME_DIST
GROUP BY not required