SQL/MP Reference Manual

HP NonStop SQL/MP Reference Manual523352-013
M-4
Considerations—MIN
ALL is an optional keyword that does not change the meaning of the clause. SQL
uses all rows (whether or not you specify ALL) unless you use the DISTINCT
clause, described next.
DISTINCT column
specifies a set of distinct column values from each row of the result table to
determine a minimum value. The column cannot be a column from a view that
corresponds to an expression in the view definition.
If you specify DISTINCT in more than one MIN function in the same statement, the
functions must reference the same column.
Duplicate rows are eliminated only if you specify DISTINCT; otherwise, all rows are
included, whether or not you specify ALL.
Specifying DISTINCT with the MIN function places no restrictions on the use of
DISTINCT with AVG, SUM, MAX, or COUNT.
Considerations—MIN
If you specify an expression or column with a character data type as the argument
to MIN, the collation used for the comparison is the collation associated with the
argument. SQL uses a binary comparison if no collation is associated with the
argument.
MIN is evaluated after eliminating all null values from the aggregate set. If the
result set is empty, MIN returns a null value.
A host variable that receives the result of the MIN function must have an indicator
variable to handle a possible null value. (For more information about using
indicator variables, see the SQL/MP programming manual for your host language.)
Example—MIN
To determine the minimum value in the SALARY column, type:
>>SELECT MIN (SALARY) FROM PERSNL.EMPLOYEE;
(EXPR)
-----------
12000.00
--- 1 row(s) selected.
MODIFY CATALOG
The MODIFY CATALOG command has two options that can be specified as the
replace-spec:
MODIFY CATALOG with REPLACE NODENAME
MODIFY CATALOG with REPLACE VOLUME