SQL Server provides a set of aggregate functions that allow you to perform calculations on a set of values and return a single result. These functions operate on a group of rows and return a single value based on the specified column or expression. Here are some commonly used SQL Server aggregate functions:
Aggregate function | Description |
AVG | The AVG() aggregate function calculates the average of non-null values in a set |
CHECKSUM_AGG | The CHECKSUM_AGG() function calculates a checksum value based on a group of rows |
COUNT | The COUNT() aggregate function returns the number of rows in a group, including rows with NULL values |
COUNT_BIG | The COUNT_BIG() aggregate function returns the number of rows (with BIGINT data type) in a group, including rows with NULL values |
MAX | The MAX() aggregate function returns the highest value (maximum) in a set of non_NULL values. |
MIN | The MIN() aggregate function returns the lowest value (minimum) in a set of non-NULL values. |
STDEV | The STDEV() function returns the statistical standard deviation of all values provided in the expression based on a sample of the data population. |
STDEVP | The STDEVP() function also returns the standard deviation for all values in the provided expression, but does so based on the entire data population. |
SUM | The SUM() aggregate function returns the summation of all Non-NULL values a set. |
VAR | The VAR() function returns the statistical variance of values in an expression based on a sample of the specified population. |
VARP | The VARP() function returns the statistical variance of values in an expression but does so based on the entire data population. |
These are just a few examples of the aggregate functions available in SQL Server. Each function has specific syntax and usage requirements, which can be found in the SQL Server documentation for the corresponding version of the software.