Aggregate_Functions_Intro1.htm
The list of following functions are mainly used to calculate group of data or group of columns, and also known as "group-functions" or "aggregated column functions"
  • AVG
  • COUNT(X): returns number of rows by an aggregated query
  • MAX
  • MEDIAN
  • MIN
  • STDDEV
  • SUM : returns the sum
  • VARIANCE: retuns variance
Typical syntax:

SELECT (COLUMN_NAME), AGGREGATE(FUNCTION) FROM TABLE_NAME
[WHERE CONDITION]
GROUP BY COLUMN-NAME
[HAVING <CONDITION>]
[ORDER BY <COLUMN-NAME / NUMBER [ASC/DESC]];

Aggregate functions in Oracle, are usually used  with the GROUP BY clause, to return a list which is grouped by one or more columns, with a distinct result for each of the groupings. The HAVING clause, is a companion clause to GROUP BY clause, which specifies certain group to appear in the results.

SELECT JOB, AVG(SAL) "AVG",
COUNT(*) "#NO" FROM EMP WHERE
JOB != 'PRESIDENT' GROUP BY JOB
HAVING AVG(SAL) < 2500