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 | 

AVG Function


The AVG function calculates the arithmetic average of the value of an expression representing all rows. Only one expression is specified as a parameter. You can get the average without duplicates by using the DISTINCT or UNIQUE keyword in front of the expression or the average of all values by omitting the keyword or by using ALL.


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

  • expression : Specifies an expression that returns a numeric value. A collection expression cannot be specified.
  • ALL : Calculates an average value for all data (default).
  • DISTINCT or UNIQUE : Calculates an average value without duplicates.

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


FROM participant

WHERE nation_code = 'KOR';

Result value : 9