SQL/MX 2.x Reference Manual (G06.24+, H06.03+)

SQL/MX Functions and Expressions
HP NonStop SQL/MX Reference Manual523725-004
9-82
MIN Function
MIN Function
MIN is an aggregate function that returns the minimum value within a set of values.
The data type of the result is the same as the data type of the argument.
ALL | DISTINCT
specifies whether duplicate values are included in the computation of the minimum
of the expression. The default option is ALL, which causes duplicate values to
be included. If you specify DISTINCT, duplicate values are eliminated before the
MIN function is applied.
expression
specifies an expression that determines the values to include in the computation of
the minimum. The expression cannot contain an aggregate function or a
subquery. The DISTINCT clause specifies that the MIN function operates on
distinct values from the one-column table derived from the evaluation of
expression. All nulls are eliminated before the function is applied to the set of
values. If the result table is empty, MIN returns NULL.
See Expressions on page 6-39.
Considerations for MIN
Operands of the Expression
The expression includes columns from the rows of the SELECT result table—but
cannot include an aggregate function. These expressions are valid:
MIN (SALARY)
MIN (SALARY * 1.1)
MIN (PARTCOST * QTY_ORDERED)
Examples of MIN
Display the minimum value in the SALARY column:
SELECT MIN (salary)
FROM persnl.employee;
(EXPR)
-----------
17000.00
--- 1 row(s) selected.
MIN ([ALL | DISTINCT] expression)