SQL Server › Aggregate Functions & GROUP BY
What are aggregate functions in SQL Server, and what are the most common ones?
BeginnerAnswer
Aggregate functions calculate a single summary value from a set of rows, such as counting how many rows exist, adding up a column, or finding the average, minimum, or maximum value. The most common ones are COUNT, SUM, AVG, MIN, and MAX, and they are frequently used to build reports and summaries from large tables.
SELECT COUNT(*) AS TotalOrders, SUM(Amount) AS TotalRevenue, AVG(Amount) AS AverageOrder
FROM Orders;Real-world example A sales manager runs a query using SUM and AVG to see the total revenue and average order value for the past month, quickly understanding overall sales performance without reviewing every individual order.