In the previous recipes, we saw how we can search and fetch data from the database. But sometimes, you want results by aggregating records, such as the average cost for last month's sales order. In this case, you can use the read_group() method to get the aggregate result.