Aggregate functions perform calculations over multiple rows.
However, they return a single value.
SQL Server offers several aggregate functions like AVG, COUNT, and MAX.
Aggregates are often used with with GROUP BY and HAVING statements.
This function returns a count of all products.
SELECT COUNT(Id) AS 'Product Count'
FROM Product
Product Count |
---|
78 |
These are the aggregate functions in SQL Server.
Click on a function for more details.
Function | Description |
---|---|
AVG | Returns the avg value of a group of values |
COUNT | Returns a count of a group of values |
COUNT_BIG | Returns a count of a group of values |
MAX | Returns the maximum value of a group of values |
MIN | Returns the minimum value of a group of values |
STDEV | Returns the standard deviation of a group of values |
STDEVP | Returns the standard deviation of a population of values |
SUM | Returns the sum of a group of values |
VAR | Returns the variance of a group of values |
VARP | Returns the variance of a population of values |