Open Source RDBMS - Seamless, Scalable, Stable and Free

한국어 | Login |Register

Versions available for this page: CUBRID 8.2.1 |  CUBRID 8.3.0 |  CUBRID 8.3.1 |  CUBRID 8.4.0 |  CUBRID 8.4.1 |  CUBRID 8.4.3 |  CUBRID 9.0.0 | 

VARIANCE Function

Description

The VARIANCE function returns a variance of expression values of all rows. Only one expression is specified as a parameter. You can get the variance without duplicates by using the DISTINCT or UNIQUE keyword in front of the expression or the variance of all values by omitting the keyword or by using ALL.

The return value may be different from the actual evaluation value because it follows the type of the expression specified as a parameter.

The following is a formula that is applied to the function.

syntax_variance.png

Syntax

VARIANCE( [DISTINCT | UNIQUE | ALL] expression )

  • expression : Specifies an expression that returns a numeric value.
  • ALL : Gets the variance for all values (default).
  • DISTINCT or UNIQUE : Gets the variance of unique values without duplicates.
Example

The following is an example that returns the variance of the number of gold medals Korea has won from 1988 to 2004 in the Olympic Games. (demodb)

SELECT VARIANCE(gold), VARIANCE(CAST (gold AS FLOAT)) FROM participant

WHERE nation_code = 'KOR';

=== <Result of SELECT Command in Line 1> ===

 

  variance(gold)  variance( cast(gold as float))

================================================

               5                   5.299995e+000