Aggregating values
The information contained in a raw data table lies dispersed across all its rows. Often, we need to condense a large table into a smaller and more readable one where its values get aggregated or summarized following a given logic. For instance, if we have a table including all orders received in the last year and want to make sense of our sales' evolution over time, we might prefer to calculate a simpler table that shows the total number of orders generated every month. Instead of having a long table with as many rows as orders, we prefer scanning through its aggregation showing only twelve rows, one for each month.
The simpler way of aggregating data is by using a rather popular database operation called Group By: it combines rows in various groups and aggregates their values within each group. To perform a Group By, you will need to decide two things:
- First, you must declare which columns define a group. All the rows showing the same values in the...