How to Calculate Average in Oracle?

  • SQL
  • 1 min read

AVG function is to calculate the average in Oracle.

Syntax

AVG function takes an aggregate expression as an argument and returns average value.

AVG (aggregate expression)

AVG Function Example

The following example will calculate the average salary by the department from the EMP table.

 SELECT deptno, AVG (sal)
FROM emp
GROUP BY deptno;

Output

DEPTNO AVG(SAL)
---------- ----------
30         1566.66667
20         2175
10         2743

See also: