Open Source RDBMS - Seamless, Scalable, Stable and Free

한국어 | 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 |

﻿

VAR_POP/VARIANCE Functions

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( [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

CREATE TABLE test_table (d double);

INSERT INTO test_table VALUES(78), (63.65), (230.54), (32), (17.2), (195.7689), (57.57);

SELECT VAR_POP(d) FROM test_table;

var_pop(d)

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

5.886658366433878e+003

SELECT VAR_POP(POWER(d,2)+d*2+1) FROM test_table;

var_pop( power(d, 2)+d*2+1)

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

3.983875901862495e+008

TRUNCATE TABLE test_table;

SELECT VAR_POP(d) FROM test_table;

var_pop(d)

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

NULL