Overview of aggregate functions in SQL
Aggregate functions in SQL are used to summarize and analyze data in a table or a query’s result set. These functions allow us to perform calculations on multiple rows of data and return a single value.
Figure 8.1 – Aggregate functions
The most common aggregate functions include the following:
COUNT
: This function returns the number of rows in a table or a result set that match a specific condition.SUM
: This function returns thesum
of all values in a specific column. It is commonly used to calculate the total value of a numeric column, such as total sales or total salary.AVG
: This function returns the average value of a specific column. It is commonly used to calculate the average value of a numeric column, such as average salary or average price.MIN
: This function returns the minimum value of a specific column. It is commonly used to determine the lowest value in a column, such...