Week 9 lec 1 2 3Aggregate Functions
Week 9 lec 1 2 3Aggregate Functions
Week 9 lec 1 2 3
Introduction
• SQL aggregation function is used to perform the
calculations on multiple rows of a single column of a
table. It returns a single value.
• It is also used to summarize the data.
• Aggregate functions ignore null values (except for
Count())
Types
COUNT FUNCTION
SELECT AVG(COST)
FROM PRODUCT_MAST;
• Output :
67.00
MAX Function
2. SELECT AVG(purch_amt)
FROM orders;
3. SELECT COUNT(DISTINCT salesman_id)
FROM orders;
4. SELECT COUNT(*) FROM customer;
Solution
5. SELECT COUNT(ALL grade)
FROM customer;
6. SELECT city, MAX(grade)
FROM customer
GROUP BY city;
7.