PL/SQL Avg

The Avg function returns the average value of an table column or expression.

Avg syntax

select avg(expression) from table;

Avg example

COURSE_IDNAMEDESCRIPTIONDURATIONPRICE
1SQL 1SQL course for beginners1 week10
2SQL 2SQL course for advanced2 week50
3HTML5Learn HTML 51 week10
4PHPPHP course4 week75
5CSSLearn CSS2 week20
select avg(price) from course;

Result: 33


select avg(price*2) from course;

Result: 66


select avg(price) from course where price between 20 and 50;

Result: 35