Aggregate Functions in SQL-

aggregate function

Aggregate Functions in SQL-

In SQL all data saved in tabular format, The aggregate functions are used for calculating a particular factor directly with use of aggregate functions. The aggregate functions are in-build functions that are used for calculating or manipulating different task. The aggregate functions are easy to use and manipulation different operations on database.

The different aggregate functions as fallows-

1) Count( )
2) Sum( )
3) Avg( )
4) Min( )
5) Max( )

We discuss each aggregate function i detail as fallows-agrigate

1. Count ()-
The count function is used for calculating a particular records or all records numbers from table.
Example-
Count(*)-Display all number of records from the table.
Count(salary)- Display all number of records of salary.
OUTPUT- 6





2. Sum( )-
The sum function are used for display a sum of particular columns from table. The sum calculating addition of given column name.
Example-
Sum(Salary)-Display total addition of salary column.
OUTPUT- 60000


3. Avg( )-
It display average of particular column.
Example-
Avg(salary)-Display Average of salary column.
OUTPUT- 12000

4. Min( )– Display a minimum value  from that column.

Example-Min(salary)

OUTPUT- 3000

 

5. Max( )Display a maximum value  from that column.

Example-Max(salary)

OUTPUT- 20000

Leave a Reply