Search⌘ K

Aggregate Functions in SQL

Explore key aggregate functions in SQL including COUNT, SUM, AVG, MIN, and MAX. Understand how to use these functions to group multiple rows into meaningful single values, enhancing your ability to summarize and analyze data within database tables. This lesson uses practical examples with the CUSTOMERS table to demonstrate these concepts clearly.

Aggregate functions in SQL

In database management, an aggregate function is a function where the values of multiple rows are grouped together to form a single value of more significant meaning.

We will discuss the following in this lesson:

  • COUNT()
  • SUM()
  • AVG()
  • MIN()
  • MAX()

Again we will be using the CUSTOMERS table.

The COUNT function

The COUNT() function returns the number of rows that match a specified criterion.

Syntax

The syntax for the COUNT() function is as follows:

SELECT
...