Mega Code Archive

 
Categories / MSSQL Tutorial / Analytical Functions
 

The VAR() return the measure of how far the extreme low range or high range value is from the middle

or mean value of the range, weighted by the greatest concentration of similar values. 11> 12> Create Table MyValues (MyValue Float) 13> GO 1> 2> Insert Into MyValues (MyValue) SELECT 2 3> Insert Into MyValues (MyValue) SELECT 3 4> Insert Into MyValues (MyValue) SELECT 4 5> Insert Into MyValues (MyValue) SELECT 5 6> Insert Into MyValues (MyValue) SELECT 6 7> GO (1 rows affected) (1 rows affected) (1 rows affected) (1 rows affected) (1 rows affected) 1> 2> SELECT VAR(MyValue) FROM MyValues 3> GO ------------------------                      2.5 (1 rows affected) 1> 2> INSERT INTO MyValues (MyValue) SELECT 3 3> INSERT INTO MyValues (MyValue) SELECT 4 4> INSERT INTO MyValues (MyValue) SELECT 4 5> INSERT INTO MyValues (MyValue) SELECT 4 6> INSERT INTO MyValues (MyValue) SELECT 5 7> GO (1 rows affected) (1 rows affected) (1 rows affected) (1 rows affected) (1 rows affected) 1> 2> SELECT VAR(MyValue) FROM MyValues 3> GO ------------------------       1.3333333333333333 (1 rows affected) 1> 2> 3> drop table MyValues; 4> GO