You are on page 1of 3

Aggregate functions in SQL:-

Creating table

1.count():-Returns total number of records

Syntax:-select count(*) from table_name;

Example:-select count(*) from data;

o/p:-

2.sum():-it is used to add the all id’s ina table data,and return output

example:-select sum(id) from data;

o/p:-
3.max():-this aggregate function is used to print the maximum marks in
marks attribute

Example:-select max(marks)from data;

o/p:-

4.min():-this function is used to print the minimum marks in the marks


attribute

Example:-select min(marks) from data;

o/p:-

5.avg():-this function is used to print the average value of the marks


attribute

Example:-select avg(marks) from data;

o/p:-
*avg function perform on two attributes and perform division
operations
Example:-select avg(marks)\avg(id) from data;
o\p:-

You might also like