•
Table of Contents
•
Index
•
Reviews
•
Examples
•
Reader Reviews
•
Errata
Transact-SQL Cookbook
By
Jonathan Gennick
,
Ales Spetic
Publisher
: O'Reilly
Pub Date
: March 2002
ISBN
: 1-56592-756-7
Pages
: 302
Slots
: 1
Copyright
Dedication
Preface
Why We Wrote This Book
Audience for This Book
Which Platform and Version?
Structure of This Book
Conventions Used in This Book
About the Code
Comments and Questions
Acknowledgments
Chapter 1. Pivot Tables
Section 1.1. Using a Pivot Table
Chapter 2. Sets
Section 2.1. Introduction
Section 2.2. The Students Example
Section 2.3. Implementing Set Difference
Section 2.4. Comparing Two Sets for Equality
Section 2.5. Implementing Partial Intersection
Section 2.6. Implementing Full Intersection
Section 2.7. Classifying Subsets
Section 2.8. Summarizing Classes of Sets
Section 2.9. Aggregating Aggregates
Section 2.10. Summarizing Aggregated Classes
Section 2.11. Including Nonaggregated Columns
Section 2.12. Finding the Top N Values in a Set
Section 2.13. Reporting the Size of a Set's Complement
Section 2.14. Finding the Complement of a Set
Section 2.15. Finding the Complement of a Missing Set
Section 2.16. Finding Complements of Sets with Different Universes
Section 2.17. Comparing a Set with Its Universe
Section 2.18. Dynamic Classification System
Chapter 3. Data Structures
Section 3.1. Types of Data Structures
Section 3.2. Working Example
Section 3.3. Finding Regions
Section 3.4. Reporting Region Boundaries
Section 3.5. Limiting Region Size
Section 3.6. Ranking Regions by Size
Section 3.7. Working with Sequences
Section 3.8. Working with Runs
Section 3.9. Cumulative Aggregates in Lists
Section 3.10. Implementing a Stack
Section 3.11. Implementing Queues
Section 3.12. Implementing Priority Queues
Section 3.13. Comparing Two Rows in an Array
Section 3.14. Printing Matrices and Arrays
Section 3.15. Transposing a Matrix
Section 3.16. Calculating a Matrix Trace
Section 3.17. Comparing Two Matrices for Size
Section 3.18. Adding and Subtracting Matrices
Section 3.19. Multiplying Matrices
Chapter 4. Hierarchies in SQL
Section 4.1. Types of Hierarchies
Section 4.2. Creating a Permission Hierarchy
Section 4.3. Changing Individual Permissions
Section 4.4. Adding New Individual Permissions
Section 4.5. Centralizing Authorization Logic
Section 4.6. Implementing General Hierarchies
Section 4.7. Traversing Hierarchies Recursively
Section 4.8. Manipulating Hierarchies Recursively
Section 4.9. Aggregating Hierarchies
Section 4.10. Preparing Multilevel Operations
Section 4.11. Aggregating Hierarchies Revised
Chapter 5. Temporal Data
Section 5.1. Introduction
Section 5.2. The Schedules Example
Section 5.3. Enforcing Granularity Rules
Section 5.4. Storing Out-of-Range Temporal Values
Section 5.5. Deriving the First and Last Dates of the Month
Section 5.6. Printing Calendars
Section 5.7. Calculating Durations
Section 5.8. Reporting Durations
Section 5.9. Querying Periods
Section 5.10. Querying Periods and Respecting Granularity
Section 5.11. Finding Available Periods
Section 5.12. Finding Common Available Periods
Section 5.13. Excluding Recurrent Events
Section 5.14. Excluding Nonrecurring Events
Section 5.15. Finding Continuous Periods
Section 5.16. Using Calendar Information with Periods
Section 5.17. Using Calendar Information with Durations
Chapter 6. Audit Logging
Section 6.1. Audit Logs
Section 6.2. The Warehouse Example
Section 6.3. Row-Level Logging
Section 6.4. Reporting Log Events
Section 6.5. Generating Current Snapshots
Section 6.6. Generating Time-Restricted Snapshots
Section 6.7. Undoing Table Changes
Section 6.8. Minimizing Audit-Log Space Consumption
Section 6.9. Online Account Balancing
Section 6.10. Activity-Level Logging
Section 6.11. Partitioning Large Log Tables
Section 6.12. Server Push
Chapter 7. Importing and Transforming Data
Section 7.1. Considerations When Importing Data
Section 7.2. Working Examples
Section 7.3. Importing External Data
Section 7.4. Importing Data into a Live System
Section 7.5. Importing with a Single Procedure
Section 7.6. Hiding the Import Procedure
Section 7.7. Folding Tables
Section 7.8. Pivoting Tables
Section 7.9. Joining Arrays with Tables
Section 7.10. Joining Arrays with Master Tables
Section 7.11. Joining Arrays with Multiple Master Records
Section 7.12. Extracting Master Records from Tables
Section 7.13. Generating Master Records Online
Section 7.14. Working with Duplicates
Chapter 8. Statistics in SQL
Section 8.1. Statistical Concepts
Section 8.2. The Light-Bulb Factory Example
Section 8.3. Calculating a Mean
Section 8.4. Calculating a Mode
Section 8.5. Calculating a Median
Section 8.6. Calculating Standard Deviation, Variance, and Standard Error
Section 8.7. Building Confidence Intervals
Section 8.8. Calculating Correlation
Section 8.9. Exploring Patterns with Autocorrelation
Section 8.10. Using a Simple Moving Average
Section 8.11. Extending Moving Averages
Appendix A. The T-Distribution Table
Colophon
Index