You are on page 1of 4

NAME :N.MADHUNIGA REG.

NO : 293575057 DEPT : IT

AGGREGATE FUNCTIONS
The Aggregate Functions are :

 AVG
 MIN
 MAX
 SUM
 COUNT

AVG :

Syntax:
select avg(<field_name>) from <table_name>;

Description:
Determines the Average of the specified values of column, ignoring null values.

MIN :

Syntax:
select min(<field_name>) from <table_name>;

Description:
Determines the Minimum value of a specified column, ignoring null values.

MAX :

Syntax:
select max(<field_name>) from <table_name>;
Description:
Determines the Maximum value of a specified column, ignoring null values.

SUM :

Syntax:
select sum(<field_name>) from <table_name>;

Description:
Determines the Sum of a specified column, ignoring null values.

COUNT :

Syntax:
select count(*) from <table_name>;
select count(<field_name>) from <table_name>;

Description:
Determines the Total number of vales of a specified column.

VARIANCE :

Syntax:
select variance(<field_name>) from <table_name>;

Description:
Determines the Variance of expression, ignoring null values.

STDDEV :

Syntax:
select stddev(<field_name>) <table_name>;

Description:
Determines the Standard deviation of a specified column, ignoring null values.
PROGRAM TO LEARN AGGREGATE FUNCTIONS

SQL> select * from Student;

REGNO NAME MARKS


--------------------- --------------------- ---------------------
1 A 100
2 B 98
3 C 95
4 D 85
5 E 75

SQL> select AVG(marks) from Student;

AVG(MARKS)
---------------------------
90.6

SQL> select MIN(marks) from Student;

MIN(MARKS)
---------------------------
75

SQL> select MAX(marks) from Student;

MAX(MARKS)
---------------------------
100

SQL> select COUNT(marks) from Student;

COUNT(MARKS)
---------------------------
5
SQL> select COUNT(*) from Student;

COUNT(*)
---------------------------
5

SQL> select SUM(marks) from Student;

SUM(MARKS)
---------------------------
453

SQL> select VARIANCE(marks) from Student;

VARIANCE(MARKS)
---------------------------
109.3

SQL> select STDDEV(marks) from Student;

STDDEV(MARKS)
---------------------------
10.454664

SQL>

RESULT :
Thus, the Aggregate Functions are executed and verified.

You might also like