Statistics Functions


Aggregate Functions

The following functions are used as aggregate in SQL Server's T-SQL the same way as the "Count", "Sum" and other aggregate functions are used.  For instance, using the sql "Select dbo.Kurtosis(Price) from Orders" will provide the Kurtosis value for the entire content of the Price column for the Orders table.

Function Parameters Description
Correlation Double X
Double Y
Pearson product-moment correlation coefficient (sometimes referred to as the PPMCC or PCC, or Pearson's r, and is typically denoted by r) is a measure of the correlation (linear dependence) between two variables X and Y, giving a value between +1 and −1 inclusive. It is widely used in the sciences as a measure of the strength of linear dependence between two variables. More Information.
Kurtosis Double X Kurtosis (from the Greek word κυρτός, kyrtos or kurtos, meaning bulging) is any measure of the "peakedness" of the probability distribution of a real-valued random variable. More Information.
Median Double X The numerical value separating the higher half of a sample, a population, or a probability distribution, from the lower half. More Information.

Double X
Double percentile
Double Method

The Percentile has three parameters:
X: the source of values within which to determine the percentile
percentile: the percentile to return - note if the percentile doesn't exist an error may be returned.
Method: the method of calculating the percentile.

Option for Method:
0: Using the method recommended my NIST
1: Using the nearest rank,
2: Using the same method as Excel does,
3: Use linear interpolation between the two nearest ranks,


Double X

Skewness is a measure of the asymmetry of the probability distribution of a real-valued random variable. The skewness value can be positive or negative, or even undefined. Qualitatively, a negative skew indicates that the tail on the left side of the probability density function is longer than the right side and the bulk of the values (possibly including the median) lie to the right of the mean. A positive skew indicates that the tail on the right side is longer than the left side and the bulk of the values lie to the left of the mean. A zero value indicates that the values are relatively evenly distributed on both sides of the mean, typically but not necessarily implying a symmetric distribution.

 Purchase SQL Math