Aggregate function count, max, min, sum, avg

9/12/2020 8:06:37 AM

SQL server hold the Aggregate function. Aggregate function nothing but a pre define function which are responsible to our work easy. Count function return the count of row matches a specified criteria. Max function return the maximum value of the row and min function return the minimum value of the row. Sum function return the total summation of the row that are numeric value. Avg function return the average value of the row that are numeric value of the specific row. Now given bellow the example of the SQL code:

select count(Id) from Salary

select  max(Salary) from Salary

select  min(Salary) from Salary

select  sum(Salary) from Salary

select  avg(Salary) from Salary

Now we can see our table name is Salary. This table have some column. Then first we count the table by using id column and then we find the maximum value by the salary column then find the minimum value using the Salary column. Find the sum the sum function and use the Salary column. Then we use the avg function for the find the average value of the specific column values by the Salary column.