Menu

SQL Server Aggregate Functions

SQL Server aggregate functions are mainly used for data statistics, such as counting, summing, averaging, etc. When combined with grouping operations, aggregate functions allow you to analyze data across multiple dimensions.

For row counts that may exceed the int range, use COUNT_BIG() rather than COUNT().

Advertisement

  1. AVG

    Learn how SQL Server AVG() ignores NULLs, chooses a return type from its input, and can overflow while summing values.
  2. COUNT

    In SQL Server, the COUNT() function is an aggregate function used to count the number of rows in a specified column or expression.
  3. COUNT_BIG

    Use SQL Server COUNT_BIG() to count rows or non-NULL values with a bigint result when COUNT()’s int range may be too small.
  4. MAX

    In SQL Server, the MAX() function is an aggregate function used to calculate the maximum value in a specified column or expression.
  5. MIN

    In SQL Server, the MIN() function is an aggregate function used to calculate the minimum value in a specified column or expression.
  6. SUM

    Learn how SQL Server SUM() ignores NULLs, returns a type based on its input, and can overflow on integer totals.