SQL/MX Quick Start (G06.24+, H06.03+)
HP NonStop SQL/MX Quick Start—523724-002
4-1
4
Displaying Information About
Groups of Rows
This section provides information about aggregate functions and how to group rows.
Selecting Values by Using Aggregate
Functions
In addition to displaying information from each row that satisfies conditions in a
WHERE clause, you can combine a group of rows that have like values in the same
column by using an aggregate function and displaying one row of information about the
group.
Examples that illustrate aggregate functions are:
Aggregate
Function
Example Meaning
AVG AVG(SALARY) Average of salaries
COUNT COUNT(DISTINCT CUSTNUM) Number of distinct customers
COUNT(*) COUNT(*) Number of rows in a group
MAX MAX(ORDER_DATE) Latest order date
MIN MIN(DELIV_DATE) Earliest delivery date
SUM SUM(QTY_ORDERED*UNIT_PRICE) Total of quantity ordered times
the unit price