Open Source RDBMS - Seamless, Scalable, Stable and Free

한국어 | Login |Register

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

STDDEV, STDDEV_POP Function

Description

The STDDEV function returns a standard deviation of the expression values of all rows. Only one expression is specified as a parameter. You can get the standard deviation without duplicates by inserting the DISTINCT or UNIQUE keyword in front of the expression, or get the standard deviation 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.

Syntaxs

STDDEV( [ { DISTINCT | DISTINCTROW } | UNIQUE | ALL] expression )

  • expression : Specifies an expression that returns a numeric value.
  • ALL : Calculates the standard deviation for all data (default).
  • DISTINCT or UNIQUE : Calculates the standard deviation without duplicates.
Example

The following is an example that returns the standard deviation of gold medals Korea won in the Olympics. (demodb)

SELECT host_year, gold FROM participant WHERE nation_code = 'KOR';

 

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

 

    host_year         gold

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

         2004            9

         2000            8

         1996            7

         1992           12

         1988           12

 

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

WHERE nation_code = 'KOR';

 

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

 

  stddev(gold)  stddev( cast(gold as float))

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

             2                 2.302172e+000