Ip PPT (Viva)
Ip PPT (Viva)
Ip PPT (Viva)
CLASS :- 12 –
SCIENCE
ROLL NO :- 30
SUBJECT :- IP
AGGREGATE FUNCTIONS
An aggregate function in SQL returns one value after
calculating multiple values of a column. We often use
aggregate functions with the GROUP BY and HAVING
clauses of the SELECT statement.
SELECT Age,
SELECT S_Name, Age
COUNT(Roll_No) AS
FROM Student WHERE No_of_Students FROM
Age >=18; Student GROUP BY Age
HAVING
COUNT(Roll_No) > 1;
EXAMPLES OF ALL TYPES OF
AGGREGATE FUNCTIONS
Let us consider table EMPOLYEE
1. SUM :-
SELECT SUM(SALARY) FROM EMPOLYEE;
2. MIN :-
SELECT MIN(SALARY) FROM EMPOLYEE;
3. MAX :-
SELECT MAX(SALARY) FROM EMPOLYEE;
4. AVG :-
SELECT AVG(SALARY) FROM EMPOLYEE;
5. COUNT :-
OPERATIONS ON RELATIONS
A set of operations takes one or two relations as
input and produces a new relation as the output.
It describes all the operations you can perform
on a table.