Aggregate Functions
Presented By:
Name of the Student: M
John Phinni
Pin number:23551A4277
Department: CSE
Lecture Details:
Specialization: AI&ML
Topic Name College : GIET(A)
Subject/Branch, Semester, Any other information if any
TYPES OF AGGREGATE FUNCTIONS IN
DBMS
• Min(Minimum value)
• Max(Maximum value)
• Sum(Addition)
• Count(no of rows)
• Avg(Average of the row)
MIN(MINIMUM VALUE)
• Min is one of the aggregate function in the DBMS.
• It is used to find the minimum value among all the values in the
numeric column.
Syntax:-
select min(column name) from table name;
Example:-
select min(marks) from student;
MAX(MAXIMUM VALUE)
• Max is one of the aggregate function in the DBMS.
• It is used to find the maximum value among all the values in the
numeric column.
Syntax:-
select max(column name) from table name;
Example:-
select max(marks) from student;
SUM(ADDITION )
• Sum is one of the aggregate function in the DBMS.
• It is used to find the addition all the values in the numeric
column.
Syntax:-
select sum(column name) from table name;
Example:-
select sum(marks) from student;
AVG(AVERAGE)
• Avg is one of the aggregate function in the DBMS.
• It is used to find the average of all the values in the numeric
column.
Syntax:-
select avg(column name) from table name;
Example:-
select avg(marks) from student;
COUNT
• count is one of the aggregate function in the DBMS.
• It is used to count the number of values that are present in a
single column .
Syntax:-
select count(column name) from table name;
Example:-
select count(marks) from student;
ID NAME BRANCH MARKS
------- ---------- ------------ -------
100 lucky csm 100
101 giri cse 98
102 sai cyber 80
103 siddu aiml 78
104 aditya csd 89
105 kalyan ece 86
106 john eee 99
7 rows selected.
SQL> select min(marks) from student;
SQL> select avg(marks) from
MIN(MARKS) student;
----------
78 AVG(MARKS)
----------
SQL> select max(marks) from student; 90
MAX(MARKS)
SQL> select count(name) from
---------- student;
100
SQL> select sum(id) from student;
COUNT(NAME)
SUM(ID)
-----------
---------- 7