08 March 2011

The Absolute Best

This month's T-SQL Tuesday is hosted by Jes Schultz Borland ( Blog | Twitter ) and she has selected Aggregate Functions as this month's topic.

Besides helping data make the transformation to information and to tell their story better, I would suggest that Aggregate Functions are the basis for all meaningful communication.

Big claim, right? Just remember, it can't be the worst claim without an aggregate function. To illustrate, I'm going to tell a short story two times. One time without aggregate fuctions, and one time with aggregate functions.

The story starts with Bobby. Yes, that's Bobby Tables, but he's all grown up now, and sells leather-free cowboy boots.

Bobby went to the computer store and purchased a post-PC device. He had just received his annual sales bonus, and wanted to splurge on something new. After making it through the checkout process and returning home, Bobby was pleased to discover that he could access his home network through the device. Bobby was content with his purchase.

Here it is again. See if you can spot the aggregate functions...

Bobby went to his favorite computer store and purchased the market leading post-PC device. He had just received his largest annual sales bonus, and wanted to splurge on something new. After making in through the most customer friendly checkout process and returning home in record time, Bobby was pleased to discover that this device had the easiest setup for accessing his home network. Bobby thought this was the best purchase he had ever made.

returning home in record time: having transit_time = min(transit_time)

easiest setup: having setup_difficulty = min(setup_difficulty)

best purchase ever: having buyers_remorse = min(buyers_remorse)

Whether it's to define What's in a Name, or to describe an evening out on the town, we can't communicate effectively without aggregate functions, and we can't learn anything from our data without them. Without aggregate functions, there is no superlative. Nothing is better than average, nothing comes first, nothing comes last, there is no typical.

So, next time somebody tells you the bathroom is the first door on the left, or you do something the fastest, or you are rated the highest, take a moment to thank your aggregate functions.