Home > SQL Server > SQL SERVER – Standard deviation functions STDEV and STDEVP – @SQLSERVER

SQL SERVER – Standard deviation functions STDEV and STDEVP – @SQLSERVER


standard deviation shows how much variation exists from the average or mean. In other words, it is the square root of the variance.

Formula for computing standard deviation using sample data:

sd_sampledataFormula for computing standard deviation using entire population data:

sd_populationdataImage source

Standard deviation functions in SQL Server

STDEV( [ ALL | DISTINCT ] column name or expression ) – This function is used to compute statistical standard deviation from sample data.

STDEVP( [ ALL | DISTINCT ] column name or expression ) – This function is used to compute statistical standard deviation for an entire population data.

ALL and DISTINCT are the keywords that are used to select all values or distinct value from the list. These functions return a float value. we should use only numeric data columns for the standard deviation computation and Null values will be ignored from the list.

 Implementation

1. Computing standard deviation using STDEV() and STDEVP() functions.

pic12. Alternative way to find standard deviation using square root function and variance functions.

pic2

Advertisements
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: