Dofactory.com
Dofactory.com
Earn income with your data and sql skills
Sign up and we'll send you the best freelance opportunities straight to your inbox.
We're building the largest freelancing marketplace for people like you.
By adding your name & email you agree to our terms, privacy and cookie policies.

SQL Aggregate Functions

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.

Example

#

This function returns a count of all products.

SELECT COUNT(Id) AS 'Product Count'
  FROM Product
Result: 1 record
Product Count
78

Aggregate Functions

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

You may also like



Last updated on Dec 21, 2023

Earn income with your data and sql skills
Sign up and we'll send you the best freelance opportunities straight to your inbox.
We're building the largest freelancing marketplace for people like you.
By adding your name & email you agree to our terms, privacy and cookie policies.