GROUP FUNCTIONS

GROUP FUNCTIONS

Group functions will be applied on all the rows but produces single output

Sum Avg Max
Min Count

 

SUM

This will give the sum of the values of the specified column.

Syntax sum (column)
EX SQL> select sum(sal) from emp;

SUM(SAL)

———-

38600

 

AVG

This will give the average of the values of the specified column

Syntax avg (column)
Ex         SQL> select avg(sal) from emp;

AVG(SAL)

—————

2757.14286

 

MAX

This will give the maximum of the values of the specified column

Syntax max (column)
EX           SQL> select max(sal) from emp;

MAX(SAL)

———-

5000

 

MIN

This will give the minimum of the values of the specified column.

Syntax min (column)
EX M        SQL> select min(sal) from emp;

 

MIN(SAL)

———-

500

 

COUNT

This will give the count of the values of the specified column

Syntax count (column)
EX           SQL> select count(sal),count(*) from emp;

COUNT(SAL)   COUNT(*)

————–    ————

14                      14

Comments