Almost all mature database applications reaches a point when it needs to start reporting back statistical and aggregated data. The data about past behavior is usually kept in a transaction history log table and you will be tempted to write some fancy SQL that selects the records in a specific timeslot and then GROUPBY type, or country, or whatever while COUNTing, SUMming and AVGing on some values like profit or whatever make sense to your company.