Aggregate functions perform calculations across multiple rows and return a summarized result. Common aggregate functions include COUNT, SUM, AVG, MIN, and MAX.
Raw transactional data can contain thousands or millions of records. Aggregate functions allow analysts to convert large datasets into meaningful business metrics.
A sales report may need total sales, average sales, highest sale, lowest sale, and number of transactions. These metrics can be calculated using aggregate functions.
SELECT
COUNT(*) AS Transactions,
SUM(SalesAmount) AS TotalSales,
AVG(SalesAmount) AS AverageSale,
MIN(SalesAmount) AS MinimumSale,
MAX(SalesAmount) AS MaximumSale
FROM Sales;
Aggregate functions are fundamental to dashboards, MIS reports, financial analysis, sales analysis, employee analytics, and business performance reporting.
- Aggregate functions summarize multiple rows.
- COUNT counts records or non-null values.
- SUM calculates totals.
- AVG calculates averages.
- MIN finds the smallest value.
- MAX finds the largest value.
What are aggregate functions?
Aggregate functions perform calculations across multiple rows and return summarized results.
Name five common aggregate functions.
COUNT, SUM, AVG, MIN, and MAX are common SQL aggregate functions.