What are SQL aggregate functions and explain few aggregate functions which you have used real time?

SQL Aggregate functions are the functions which perform calculations on the group of data and returns a single value.

  • Except COUNT() function, all other aggregate functions ignore NULL values.
  • When we are using aggregate functions in SELECT list, it is mandatory to include other columns in GROUP BY clause.

Aggregate functions I used frequently:

COUNT() — Used for counting the number of records in the result set.

SUM() — Used for calculating the sum of values in a group of data.

AVG() — Used for calculating the average of values in a group of data.

MIN() — Used for calculating the Minimum value among values in a group of data.

MAX() — Used for calculating the Maximum value among values in a group of data.

               There are few more aggregate functions in SQL Server. CHECKSUM_AGG, STDEV, COUNT_BIG, STDEVP, GROUPING, VAR and VARP

Leave a Reply

Your email address will not be published. Required fields are marked *