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. An expression that returns a collection-type data is not allowed.
  • ALL: Calculates an average value for all data (default).
  • DISTINCT or UNIQUE: Calculates an average value without duplicates.

The following example shows how to retrieve the average number of gold (gold) medals that Korea won in Olympics in the demodb database.


FROM participant

WHERE nation_code = 'KOR';