SQL/MX Quick Start (H06.04+, J06.03+)

HP NonStop SQL/MX Quick Start540438-001
4-1
4
Displaying Information About
Groups of Rows
This section describes 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 use an aggregate function to combine rows with like values in
the same column into a group and display 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