| Preface | p. xi |
| Pivot Tables | p. 1 |
| Using a Pivot Table | p. 1 |
| Sets | p. 5 |
| Introduction | p. 5 |
| The Students Example | p. 12 |
| Implementing Set Difference | p. 13 |
| Comparing Two Sets for Equality | p. 16 |
| Implementing Partial Intersection | p. 18 |
| Implementing Full Intersection | p. 21 |
| Classifying Subsets | p. 22 |
| Summarizing Classes of Sets | p. 24 |
| Aggregating Aggregates | p. 26 |
| Summarizing Aggregated Classes | p. 27 |
| Including Nonaggregated Columns | p. 28 |
| Finding the Top N Values in a Set | p. 30 |
| Reporting the Size of a Set's Complement | p. 33 |
| Finding the Complement of a Set | p. 34 |
| Finding the Complement of a Missing Set | p. 36 |
| Finding Complements of Sets with Different Universes | p. 38 |
| Comparing a Set with Its Universe | p. 39 |
| Dynamic Classification System | p. 40 |
| Data Structures | p. 45 |
| Types of Data Structures | p. 45 |
| Working Example | p. 50 |
| Finding Regions | p. 53 |
| Reporting Region Boundaries | p. 54 |
| Limiting Region Size | p. 55 |
| Ranking Regions by Size | p. 57 |
| Working with Sequences | p. 58 |
| Working with Runs | p. 60 |
| Cumulative Aggregates in Lists | p. 61 |
| Implementing a Stack | p. 63 |
| Implementing Queues | p. 65 |
| Implementing Priority Queues | p. 66 |
| Comparing Two Rows in an Array | p. 67 |
| Printing Matrices and Arrays | p. 69 |
| Transposing a Matrix | p. 70 |
| Calculating a Matrix Trace | p. 71 |
| Comparing Two Matrices for Size | p. 72 |
| Adding and Subtracting Matrices | p. 73 |
| Multiplying Matrices | p. 74 |
| Hierarchies in SQL | p. 78 |
| Types of Hierachies | p. 79 |
| Creating a Permission Hierarchy | p. 84 |
| Changing Individual Permissions | p. 88 |
| Adding New Individual Permissions | p. 90 |
| Centralizing Authorization Logic | p. 92 |
| Implementing General Hierarchies | p. 93 |
| Traversing Hierarchies Recursively | p. 96 |
| Manipulating Hierarchies Recursively | p. 99 |
| Aggregating Hierarchies | p. 100 |
| Preparing Multilevel Operations | p. 103 |
| Aggregating Hierarchies Revised | p. 106 |
| Temporal Data | p. 110 |
| Introduction | p. 110 |
| The Schedules Example | p. 119 |
| Enforcing Granularity Rules | p. 119 |
| Storing Out-of-Range Temporal Values | p. 121 |
| Deriving the First and Last Dates of the Month | p. 122 |
| Printing Calendars | p. 124 |
| Calculating Durations | p. 126 |
| Reporting Durations | p. 128 |
| Querying Periods | p. 129 |
| Querying Periods and Respecting Granularity | p. 130 |
| Finding Available Periods | p. 132 |
| Finding Common Available Periods | p. 134 |
| Excluding Recurrent Events | p. 135 |
| Excluding Nonrecurring Events | p. 136 |
| Finding Continuous Periods | p. 138 |
| Using Calendar Information with Periods | p. 145 |
| Using Calendar Information with Durations | p. 147 |
| Audit Logging | p. 150 |
| Audit Logs | p. 150 |
| The Warehouse Example | p. 155 |
| Row-Level Logging | p. 155 |
| Reporting Log Events | p. 160 |
| Generating Current Snapshots | p. 163 |
| Generating Time-Restricted Snapshots | p. 165 |
| Undoing Table Changes | p. 166 |
| Minimizing Audit-Log Space Consumption | p. 168 |
| Online Account Balancing | p. 173 |
| Activity-Level Logging | p. 178 |
| Partitioning Large Log Tables | p. 183 |
| Server Push | p. 184 |
| Importing and Transforming Data | p. 189 |
| Considerations When Importing Data | p. 189 |
| Working Examples | p. 196 |
| Importing External Data | p. 198 |
| Importing Data into a Live System | p. 200 |
| Importing with a Single Procedure | p. 204 |
| Hiding the Import Procedure | p. 205 |
| Folding Tables | p. 208 |
| Pivoting Tables | p. 211 |
| Joining Arrays with Tables | p. 215 |
| Joining Arrays with Master Tables | p. 217 |
| Joining Arrays with Multiple Master Records | p. 219 |
| Extracting Master Records from Tables | p. 220 |
| Generating Master Records Online | p. 223 |
| Working with Duplicates | p. 229 |
| Statistics in SQL | p. 235 |
| Statistical Concepts | p. 236 |
| The Light-Bulb Factory Example | p. 249 |
| Calculating a Mean | p. 252 |
| Calculating a Mode | p. 253 |
| Calculating a Median | p. 255 |
| Calculating Standard Deviation, Variance, and Standard Error | p. 259 |
| Building Confidence Intervals | p. 260 |
| Calculating Correlation | p. 261 |
| Exploring Patterns with Autocorrelation | p. 262 |
| Using a Simple Moving Average | p. 265 |
| Extending Moving Averages | p. 267 |
| The T-Distribution Table | p. 271 |
| Index | p. 273 |
| Table of Contents provided by Syndetics. All Rights Reserved. |