Structure of This Book
This book is divided into eight chapters. You can read through all
eight chapters sequentially, or you can read only those chapters that
pertain to problems you are solving at any given time.
The only exception is Chapter 1, which you should
read first no matter which other chapter you read next.
Chapter 1, introduces the concept and use of a
Pivot table. This recipe is in a chapter by itself, because we use
the Pivot table pattern in many other recipes throughout the book.
This is a must-read chapter.
Chapter 2, focuses on the core of
SQL's functionality: set manipulation. In this
chapter, you'll find techniques for performing the
set operations you learned in elementary school, such as difference,
intersection, and compliment, using SQL. You'll also
find techniques for returning the top-n values from a set and for
implementing various types of aggregation.
Chapter 3, shows you how to implement lists,
stacks, queues, arrays, and matrices using Transact-SQL. Such
structures are often considered the domain of other programming
languages, but it's sometimes advantageous to
implement them at the database level.
Chapter 4, shows you several useful techniques for
dealing with hierarchical data from SQL. Hierarchical data presents
some special challenges because SQL is optimized for relational data.
Readers who have been in the industry long enough will recall that
relational databases replaced hierarchical
databases. Nonetheless, hierarchical data exists and we must deal
with it.
Chapter 5, demonstrates the ins and outs of
working with time-based, or temporal, data. Temporal data is
frequently encountered in the business world, and failure to
recognize the subtleties of querying such data is a common source of
errors. In this chapter, you'll learn about
granularity and about SQL Server's built-in support
for temporal data. You'll then find a number of
recipes that show SQL being used creatively to solve various time-
and date- related problems.
Chapter 6, deals with the problem of logging
changes and implementing audit trails. Learn how to implement an
audit-trail mechanism using Transact-SQL, how to generate audit
snapshots of a given point in time, and other related techniques.
Chapter 7, speaks to the issues involved with
getting data into SQL Server from external sources.
You'll find recipes for importing data into
"live" systems, for validating
imported data, and for dealing with master/detail data.
Chapter 8, is a mini-course in statistics.
You'll see how to use SQL to calculate means, modes,
medians, standard deviations, variances, and standard errors.
You'll also learn how to implement moving averages,
calculate correlations, and use confidence intervals.
Wherever possible, recipes build on data from previous recipes in the
same chapter, so reading through a chapter should be fairly
straightforward. If you want to experiment with just one particular
recipe, check the beginning of its chapter for a description of the
example data used in that chapter, or download the recipe-specific
script files that create example data from this
book's web page (http://oreilly.com/catalog/transqlcook ).
|