Fast and Furious: Discovering Windowing Function

Preview:

Citation preview

Fast and Furious: Discovering Windowing FunctionAhias PortilloPortillo.ahias@Outlook.comMVP, MCITP en Sql ServerDPA, SolidQ

What they can do WF?

What we DO?

We do things must not do

Window Functions

(Fabiano Amorim, Window Functions in Sql Server)

What can I do?

Paging De-duplicating data Returning top n rows

per group Computing running

totals

Identifying gaps and islands

Computing percentiles

Computing the mode of the distribution

You can imagine….

OVER

Aggregate Function

AVG CHECKSUM_AGG COUNT COUNT_BIG

MAX MIN SUM VAR VARP

DEMO

Ranking Functions

ROW_NUMBER RANK DENSE_RANK NTILE

DEMO

Offset Functions

LAG() LEAD() LAST_VALUE() FIRST_VALUE()

DEMO

Distribution Functions

CUME_DIST() PERCENT_RANK() PERCENTILE_CONT() PERCENTILE_DISC()

DEMO

Q & A

?