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
-
AVG
Learn how SQL Server AVG() ignores NULLs, chooses a return type from its input, and can overflow while summing values. -
COUNT
In SQL Server, theCOUNT()function is an aggregate function used to count the number of rows in a specified column or expression. -
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. -
MAX
In SQL Server, theMAX()function is an aggregate function used to calculate the maximum value in a specified column or expression. -
MIN
In SQL Server, theMIN()function is an aggregate function used to calculate the minimum value in a specified column or expression. -
SUM
Learn how SQL Server SUM() ignores NULLs, returns a type based on its input, and can overflow on integer totals.