Press "Enter" to skip to content

How to Calculate Average in Oracle?

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:

Vinish Kapoor

Hi, I am a full stack developer and writing about development. I document everything I learn and help thousands of people. foxinfotech.in is created, written, and maintained by me; it is built on WordPress, and hosted by Bluehost. Connect with me on Facebook, Twitter, GitHub, and get notifications for new posts.

Be First to Comment

    Leave a Reply

    Your email address will not be published. Required fields are marked *