TSO-ISPF JCL COBOL VSAM DB2 CICS Tools Articles Job Portal Forum Quiz Interview Q&A

DB2 - SQL Aggregate Functions


Aggregate Functions are functions that operate on a set of rows to calculate and return a single value.

It is often necessary to summarize data without actually retrieving it all, and SQL provides special functions for this purpose.

Examples of this type of retrieval are:

  • Determining the number of rows in a table.

  • Obtaining the sum of a set of rows in a table.

  • Finding the highest, lowest, and average values in a table column.


Following is the list of frequently using Aggregate Functions:

FunctionDescription
AVG()Returns a column's average value
COUNT()Returns the number of rows in a column
MIN()Returns a column's highest value
MAX()Returns a column's lowest value
SUM()Returns the sum of a column's values

We will see each function with examples in next chapter...


If you have any doubts or queries related to this chapter, get them clarified from our Mainframe experts on ibmmainframer Community!

Are you looking for Job Change? Job Portal