0% found this document useful (0 votes)
36 views3 pages

Aggregate Functions in SQL

This document discusses several aggregate functions in SQL including count(), sum(), max(), min(), and avg(). Count() returns the total number of records. Sum() adds all values of a given column. Max() and min() return the highest and lowest values in a column respectively. Avg() calculates the average value of a given column. These functions are useful for aggregating data from tables in a database.

Uploaded by

Jaya Vakapalli
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
36 views3 pages

Aggregate Functions in SQL

This document discusses several aggregate functions in SQL including count(), sum(), max(), min(), and avg(). Count() returns the total number of records. Sum() adds all values of a given column. Max() and min() return the highest and lowest values in a column respectively. Avg() calculates the average value of a given column. These functions are useful for aggregating data from tables in a database.

Uploaded by

Jaya Vakapalli
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 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