1/25/2012

The new Analytic functions in SQL Server 2012 - SQLServerCentral

Analytic Functions

It’s hard to describe the overall purpose of the analytic functions better than how Books Online (BOL) does: “Analytic functions compute an aggregate value based on a group of rows. However, unlike aggregate functions, they can return multiple rows for each group. You can use analytic functions to compute moving averages, running totals, percentages or top-N results within a group.”

SQL Server 2012 adds eight analytic functions, all of which require the use of the OVER clause. These are LAG, LEAD, FIRST_VALUE, LAST_VALUE, CUME_DIST, PERCENT_RANK, PERCENTILE_CONT, and PERCENTILE_DISC. Ther article referenced below will look at each one of these in more detail.

The new Analytic functions in SQL Server 2012 - SQLServerCentral

No comments: