Chapter 5 ADVANCED DATA RETRIEVAL AND MODIFICATION 271

Chapter 5 ADVANCED DATA RETRIEVAL AND MODIFICATION 271 GROUPING DATA WITH TRANSACT-SQL . Group data using Transact-SQL. SQL Server is all about reporting. If you think that the database you re designing is for storing data, you are looking at design from the wrong angle. Reporting is typically how things come out of the database. If your database is for a payroll system, reporting is how it prints checks. If your database is for a cargo shipping application, then reporting is how it prints invoices and how many widgets the company will need to make next month if sales continue at the same rate. Reporting is what makes money for companies. Without effective ways of reading and presenting data, there are no payroll checks, shipping invoices, or sales projections. Reporting is being able to count things, average things, find maximum values, and find minimum values, and do all that over different categories of data. If you ve ever been involved in a report design, then you know that most reports are all about grouping different entities together and describing how those entities behave. How many widgets did we sell last month, what was the average cost to produce, and what was the average selling price? Those are the things that drive how business is done. This section is going to cover big topics. It describes how to aggregate data, how to perform operations on those aggregates, and how to do computations across aggregates. Remember, it s all about the slice and dice. Aggregate Functions Aggregate functions are functions that provide summary data about sets. Questions like How many rows are in that table? How many widgets did we sell last week? and What is the average price we charged for a widget? are all answered with aggregate functions. Table 5.1 provides a list and a brief description of each aggregate function. This section also covers what they do and their syntax.

For high quality website hosting services please check cheap web hosting website.

Comments are closed.