.-ALL------. >>-MIN--(----+----------+--expression--)----------------------->< '-DISTINCT-'
The schema is SYSIBM.
The MIN function returns the minimum value in a set of values.
The argument values can be of any built-in type other than a long string or DATALINK.
If DISTINCT is used, the resulting expression must not have a length greater than 254 for a character column or 127 for a graphic column.
The data type, length, and code page of the result are the same as the data type, length, and code page of the argument values. The result is considered to be a derived value and can be null.
The function is applied to the set of values derived from the argument values by the elimination of null values.
If this function is applied to an empty set, the result of the function is a null value. Otherwise, the result is the minimum value in the set.
The specification of DISTINCT has no effect on the result and therefore is not recommended. It is included for compatibility with other relational systems.
Examples:
SELECT MAX(COMM) - MIN(COMM) INTO :COMM_SPREAD FROM EMPLOYEE WHERE WORKDEPT = 'D11'
Results in COMM_SPREAD being set to 1118 (that is, 2580 - 1462) when using the sample table.
SELECT MIN(PRENDATE) INTO :FIRST_FINISHED FROM PROJECT
Results in FIRST_FINISHED being set to '1982-09-15' when using the sample table.