IT lexicon › Database › Aggregate

Aggregate

Database På svenska → Updated: 2026-11-11

A database operation that combines multiple rows into a single value — typically used for sums, counts, averages, or other statistics.

Aggregation is the opposite of joining. Where joins spread data from one row across many, aggregates collapse many rows into one. SQL functions like SUM(), COUNT(), AVG(), MIN(), and MAX() are aggregate functions. They take a column from many rows and return a single result. Aggregates are often combined with GROUP BY to compute per-group statistics — total sales by month, average price by category, customer count by region.

Aggregation is intuitive but requires careful SQL thinking. A GROUP BY query must ensure all non-aggregated columns are deterministic given the grouping keys, otherwise results are unpredictable. Aggregates were introduced in early SQL and remain fundamental to nearly all data analysis. Hard to imagine a database without them. Window functions have extended aggregation to sliding windows, but basic aggregates with GROUP BY remain the most common data summarization technique.

← Back to the lexicon