SQL Aggregate Function

Introduction

Aggregate functions perform calculations on a set of values and return a single value. With the exception of the COUNT aggregate function, all other aggregate functions ignore NULL Values.

Aggregate functions are frequently used with the GROUP BY clause of the SELECT Statement.

List of Aggregate Functions

  1. AVG
  2. CHECKSUM_AGG
  3. COUNT
  4. COUNT_BIG
  5. MAX
  6. MIN
  7. SUM
  8. STDEV
  9. STDEVP
  10. VAR
  11. VARP
See all available data

data

Explaining the above functions:
  1. AVG: Return the average of the values. The expression contains numeric value.

    avg

  2. CHECKSUM_AGG: Return the checksum of the values in group. Null Values are ignored,

    CHECKSUM_AGG

  3. COUNT: Returns row count and int data type value always. It can be followed by Over clause.

    COUNT

  4. COUNT_BIGCount_big work in the same way as Count function but difference is that count_big return big int data type values. 

    COUNT_BIG

  5. MAX: Return maximum value in expression. It ignores Null Values and can be followed by over clause.

    MAX

  6. Min: Return minimum values in expression and ignores Null values. 

    Min

  7. SUM: Return sum of all the values, or only the distinct values.

  8. SUM

  9. STDEV: Return the statistical standard deviation of all values in specified expression. It ignores null values.

    STDEV

  10. STDEVP: Return the statistical standard deviation for the population for all values in specified expression. It ignores Null Values.

    STDEVP

  11. VAR: Return the statistical variance of all variables in specified expression. It ignores Null Values .

    VAR

  12. VARP: Return statistical Variance for the population for all values in specified expression. It ignores Null Values.

    VARP
Note: If you have any question regarding this article, then please mention in the comments section.


Similar Articles