Aggregate Function:-
- Operation: It takes a more than one value as input and returns a single value as output
- Symbol: G
- Notation: G function (attribute) (relation)
- Aggregate functions: Sum, Count, Max, Min, Avg.
Consider following table
Rno |
Name |
Dept |
CPI |
101 |
Ramesh |
CE |
8 |
108 |
Mahesh |
EC |
6 |
109 |
Amit |
CE |
7 |
125 |
Chetan |
CI |
8 |
138 |
Mukesh |
ME |
7 |
128 |
Reeta |
EC |
6 |
133 |
Anita |
CE |
9 |
Example: Find out sum of all students CPI.
G sum (CPI) (Student)
Output: The above query returns sum of CPI.
Example: Find out max and min CPI.
G max (CPI), min (CPI) (Student)
Output: The above query returns sum of CPI.