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 | 

MIN Function

Description

The MIN function retrieves the minimum value of the specified expression or path expression. The character strings are compared in dictionary order. The minimum value is the one closest to the first entry in the dictionary. For other data types, the minimum value is the smallest value. The MIN function cannot be used for attributes that include collections or object domains (user-defined classes or multimedia classes).

Syntax

MIN ( [ DISTINCT | UNIQUE | ALL ] expression )

With expression for the MIN function, you can specify a single-value expression.

  • expression : Specifies the expression to calculate the minimum value.
  • ALL : Gets the minimum value of all instances (default).
  • DISTINCT or UNIQUE : Gets the minimum value of unique values without duplicates.
  • However, whether you use the keyword DISTINCT, UNIQUE or ALL, you will get the same minimum value as the result.
Example

The following is an example of returning the minimum number of gold medals that Korea won in the Olympic Games from 1988 to 2004.

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

Result : 7