© The Author(s), under exclusive license to APress Media, LLC, part of Springer Nature 2023
M. SimonLeveling Up with SQLhttps://doi.org/10.1007/978-1-4842-9685-1_5

5. Aggregating Data

Mark Simon1  
(1)
Ivanhoe VIC, VIC, Australia
 

Databases store data. That’s obvious, but the data itself is pretty inert—you save it, you retrieve it, and you sometimes change it. That’s OK for some things, but sometimes you want the data to work a little harder.

You can put the data to work when you start to summarize it. You can then see trends, see where it’s going, or just get an overview of the data.

Aggregate functions are used to calculate summaries of data. They have three contexts:
  • Summarize the whole table.

  • Summarize in groups, using GROUP BY.

  • Include summaries ...

Get Leveling Up with SQL: Advanced Techniques for Transforming Data into Insights now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.