SQL Series: Part 3— SQL Aggregate Functions with Sample

Harris Wan
3 min readAug 24, 2024

Check Out Part 2 of the SQL Series:

Credit: Google Image

What is Aggregate Function?

Definition: A set of functions used to perform calculations or summarize data across multiple rows in a table, and return a single value.

Common SQL Aggregations:

  • COUNT: Counts the number of rows in a specified table or view
  • SUM: Calculates the sum of all values in a specified column
  • AVG: Calculates the average value of a specified column
  • MAX: Returns the maximum value in a specified column
  • MIN: Returns the minimum value in a specified column

To better understand and visualize how the aggregate functions works in the real world, the following employee table is created for illustration:

Employee Table
+-------------+-------------------+--------+
| employee_id | title | salary |
+-------------+-------------------+--------+
| 1001 | manager | 100000 |
| 1002 | data…

--

--

Harris Wan

Data Analyst | Shares about data and Help you break into data!