SQL aggregate functions return a single value, calculated from values in a column.
Useful aggregate functions:
AVG() - Returns the average value
select avg(sal),avg(distinct(sal)),deptno from emp group by deptno;
COUNT() - Returns the number of rows
select (*) from emp;
MAX() - Returns the largest value
select max(sal),deptno from emp group by deptno;
MIN() - Returns the smallest value
select min(sal),deptno from emp group by deptno;
SUM() - Returns the sum
select sum(sal),avg(distinct(sal)),deptno from emp group by deptno;