SQL

Aggregate Functions

Learn how to perform calculations on a set of values.

By TechCoder TeamLast updated: 2026-06-02
In a Nutshell

Learn how to perform calculations on a set of values. This hands-on tutorial focuses on practical implementation of aggregate functions concepts.

What are Aggregate Functions?

Aggregate functions perform a calculation on a set of values and return a single value. They are often used with the GROUP BY clause.

Common aggregate functions:

  • COUNT(): Returns the number of rows.
  • SUM(): Returns the total sum of a numeric column.
  • AVG(): Returns the average value of a numeric column.
  • MIN(): Returns the smallest value.
  • MAX(): Returns the largest value.

Example: COUNT

Count the total number of products.

SQL PLAYGROUND
⏳ Loading editor…

Example: SUM and AVG

Calculate the total price of all products and the average price.

SQL PLAYGROUND
⏳ Loading editor…

Example: MIN and MAX

Find the cheapest and most expensive product prices.

SQL PLAYGROUND
⏳ Loading editor…