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 | 

MAX Function


The MAX function gets the greatest value of expressions of all rows. Only one expression is specified.

For expressions that return character strings, the string that appears later in alphabetical order becomes the maximum value; for those that return numbers, the greatest value becomes the maximum value.


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

  • expression: Specifies an expression that returns a numeric or string value. An expression that returns a collection-type data is not allowed.
  • ALL: Gets the maximum value for all data (default).
  • DISTINCT or UNIQUE: Gets the maximum value without duplicates.

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

SELECT MAX(gold) FROM participant WHERE nation_code = 'KOR';