rent-now

Rent More, Save More! Use code: ECRENTAL

5% off 1 book, 7% off 2 books, 10% off 3+ books

9780735658363

Microsoft SQL Server 2012 High-Performance T-SQL Using Window Functions

by
  • ISBN13:

    9780735658363

  • ISBN10:

    0735658366

  • Format: Paperback
  • Copyright: 2012-04-15
  • Publisher: Microsoft Press
  • View Upgraded Edition
  • Purchase Benefits
  • Free Shipping Icon Free Shipping On Orders Over $35!
    Your order must be $35 or more to qualify for free economy shipping. Bulk sales, PO's, Marketplace items, eBooks and apparel do not qualify for this offer.
  • eCampus.com Logo Get Rewarded for Ordering Your Textbooks! Enroll Now
List Price: $36.99

Summary

Perform efficient database queries with T-SQL window functions Get a detailed look into the practical applications of window functions in Transact-SQL-the database programming language built into Microsoft SQL Server. Led by T-SQL expert Itzik Ben-Gan, you'll learn how to perform calculations against sets of rows in your database-in a flexible, clear, and efficient manner. Delve into SQL windowing concepts and discover practical uses for various T-SQL window functions. Discover how to: Apply SQL windowing concepts and window function design Gain experience with window aggregate, ranking, offset, and distribution functions Know when to use SQL ordered set functions, such as hypothetical set functions and inverse distribution functions Optimize window functions in SQL Server 2012 Use practical examples of T-SQL window functions to address common business tasks

Author Biography

Itzik Ben-Gan, a Microsoft MVP for SQL Server since 1999, is cofounder of SolidQ, a company that provides consulting and training services for the entire Microsoft data platform. He writes numerous articles for SQL Server Pro magazine and speaks at industry events such as the Professional Association for SQL Server (PASS) and Microsoft TechEd.

Table of Contents

Forewordp. xi
Introductionp. xiii
SQL Windowingp. 1
Background of Window Functionsp. 2
Window Functions Describedp. 2
Set-Based vs. Iterative/Cursor Programmingp. 6
Drawbacks of Alternatives to Window Functionsp. 11
A Glimpse of Solutions Using Window Functionsp. 15
Elements of Window Functionsp. 19
Partitioningp. 20
Orderingp. 21
Framingp. 22
Query Elements Supporting Window Functionsp. 23
Logical Query Processingp. 23
Clauses Supporting Window Functionsp. 25
Circumventing the Limitationsp. 28
Potential for Additional Filtersp. 30
Reuse of Window Definitionsp. 31
Summaryp. 32
A Detailed Look at Window Functionsp. 33
Window Aggregate Functionsp. 33
Window Aggregate Functions Describedp. 33
Supported Windowing Elementsp. 34
Further Filtering Ideasp. 49
Distinct Aggregatesp. 51
Nested Aggregatesp. 53
Ranking Functionsp. 57
Supported Windowing Elementsp. 58
Row_Numberp. 58
Ntilep. 63
Rank and Dense_Rankp. 66
Distribution Functionsp. 68
Supported Windowing Elementsp. 68
Rank Distribution Functionsp. 68
Inverse Distribution Functionsp. 71
Offset Functionsp. 74
Supported Windowing Elementsp. 74
Lag and Leadp. 74
First_Value, Last_Value, and NTH_Valuep. 76
Summaryp. 79
Ordered Set Functionsp. 81
Hypothetical Set Functionsp. 82
Rankp. 82
Dense_Rankp. 84
Percent_Rankp. 85
Cume_Distp. 86
General Solutionp. 87
Inverse Distribution Functionsp. 90
Offset Functionsp. 94
String Concatenationp. 98
Summaryp. 100
Optimization of Window Functionsp. 101
Sample Datap. 101
Indexing Guidelinesp. 103
POC Indexp. 104
Backward Scansp. 105
Columnstore Indexesp. 108
Ranking Functionsp. 108
Row_Numberp. 109
Ntilep. 110
Rank and Dense_Rankp. 111
Improved Parallelism with Applyp. 112
Aggregate and Offset Functionsp. 116
Without Ordering and Framingp. 116
With Ordering and Framingp. 119
Distribution Functionsp. 128
Rank Distribution Functionsp. 128
Inverse Distribution Functionsp. 129
Summaryp. 132
T-SQL Solutions Using Window Functionsp. 133
Virtual Auxiliary Table of Numbersp. 133
Sequences of Date and Time Valuesp. 137
Sequences of Keysp. 138
Update a Column with Unique Valuesp. 138
Applying a Range of Sequence Valuesp. 139
Pagingp. 143
Removing Duplicatesp. 145
Pivotingp. 148
Top N per Groupp. 151
Modep. 154
Running Totalsp. 158
Set-Based Solution Using Window Functionsp. 160
Set-Based Solutions Using Subqueries or Joinsp. 161
Cursor-Based Solutionp. 162
CLR-Based Solutionp. 164
Nested Iterationsp. 166
Multirow Update with Variablesp. 167
Performance Benchmarkp. 169
Max Concurrent Intervalsp. 171
Traditional Set-Based Solutionp. 173
Cursor-Based Solutionp. 175
Solutions Based on Window Functionsp. 178
Performance Benchmarkp. 180
Packing Intervalsp. 181
Traditional Set-Based Solutionp. 183
Solutions Based on Window Functionsp. 184
Gaps and Islandsp. 193
Gapsp. 194
Islandsp. 195
Medianp. 202
Conditional Aggregatep. 204
Sorting Hierarchiesp. 206
Summaryp. 210
Indexp. 211
Table of Contents provided by Ingram. All Rights Reserved.

Supplemental Materials

What is included with this book?

The New copy of this book will include any supplemental materials advertised. Please check the title of the book to determine if it should include any access cards, study guides, lab manuals, CDs, etc.

The Used, Rental and eBook copies of this book are not guaranteed to include any supplemental materials. Typically, only the book itself is included. This is true even if the title states it includes any access cards, study guides, lab manuals, CDs, etc.

Rewards Program