NonStop SQL/MP Reference Manual

Table Of Contents
NonStop SQL/MP Reference Manual142115
S-89
Considerations—SUM
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 to average from each row of the result
table.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 SUM function in the same statement,
the functions must reference the same column.
Considerations—SUM
Null values
SUM is evaluated after eliminating all null values from the aggregate set. If the
result set is empty, SUM returns a null value.
Indicator required for host variables
A host variable that receives the result of the SUM function must have an indicator
variable to handle a possible null value. (For more information about using indicator
variables, see the NonStop SQL/MP programming manual for your host language.)
Examples—SUM
To compute the total value of parts in the current inventory (the sum of each value in
the PRICE column multiplied by the corresponding value in the QTY_AVAILABLE
column), type the following:
>> SELECT SUM (PRICE * QTY_AVAILABLE) FROM SALES.PARTS;
(EXPR)
-----------
83052750.00
--- 1 row(s) selected.
Super ID
The super ID is a Guardian user ID with group number 255 and user number 255. The
super ID is intended for system maintenance and administration and has many special
privileges.
The super ID can read, write to, execute, and purge any object on the local node. The
super ID can also resecure and alter attributes of objects on the local node.
A super ID on one node in a network does not have super ID privileges on other nodes
in the network. Most super ID privileges require being directly logged on the local node
as the super ID. However, a super ID with a remote password (not a logon password) to