Tackle the toughest set-based querying and query tuning problems—guided by an author team with in-depth, inside knowledge of T-SQL. Deepen your understanding of architecture and internals—and gain practical approaches and advanced techniques to optimize your code’s performance.



Discover how to:





Move from procedural programming to the language of sets and logic
Optimize query tuning with a top-down methodology
Assess algorithmic complexity to predict performance
Compare data-aggregation techniques, including new grouping sets
Manage data modification—insert, delete, update, merge—for performance
Write more efficient queries against partitioned tables
Work with graphs, trees, hierarchies, and recursive queries
Plus—Use pure-logic puzzles to sharpen your problem-solving skills

T-SQL insiders help you tackle your toughest queries and query-tuning problems
Squeeze maximum performance and efficiency from every T-SQL query you write or tune. Four leading experts take an in-depth look at T-SQL’s internal architecture and offer advanced practical techniques for optimizing response time and resource usage. Emphasizing a correct understanding of the language and its foundations, the authors present unique solutions they have spent years developing and refining. All code and techniques are fully updated to reflect new T-SQL enhancements in Microsoft SQL Server 2014 and SQL Server 2012.

Write faster, more efficient T-SQL code:
  • Move from procedural programming to the language of sets and logic
  • Master an efficient top-down tuning methodology
  • Assess algorithmic complexity to predict performance
  • Compare data aggregation techniques, including new grouping sets
  • Efficiently perform data-analysis calculations
  • Make the most of T-SQL’s optimized bulk import tools
  • Avoid date/time pitfalls that lead to buggy, poorly performing code
  • Create optimized BI statistical queries without additional software
  • Use programmable objects to accelerate queries
  • Unlock major performance improvements with In-Memory OLTP
  • Master useful and elegant approaches to manipulating graphs

About This Book
  • For experienced T-SQL practitioners
  • Includes coverage updated from Inside Microsoft SQL Server 2008 T-SQL Querying and Inside Microsoft SQL Server 2008 T-SQL Programming
  • Valuable to developers, DBAs, BI professionals, and data scientists
  • Covers many MCSE 70-464 and MCSA/MCSE 70-461 exam topics





T-SQL Window Functions

by Itzik Ben-Gan

Published 15 April 2012

Use window functions to write simpler, better, more efficient T-SQL queries

 Most T-SQL developers recognize the value of window functions for data analysis calculations. But they can do far more, and recent optimizations make them even more powerful. In T-SQL Window Functions, renowned T-SQL expert Itzik Ben-Gan introduces breakthrough techniques for using them to handle many common T-SQL querying tasks with unprecedented elegance and power. Using extensive code examples, he guides you through window aggregate, ranking, distribution, offset, and ordered set functions. You’ll find a detailed section on optimization, plus an extensive collection of business solutions — including novel techniques available in no other book.

 

Microsoft MVP Itzik Ben-Gan shows how to:

• Use window functions to improve queries you previously built with predicates

• Master essential SQL windowing concepts, and efficiently design window functions

• Effectively utilize partitioning, ordering, and framing

• Gain practical in-depth insight into window aggregate, ranking, offset, and statistical functions

• Understand how the SQL standard supports ordered set functions, and find working solutions for functions not yet available in the language

• Preview advanced Row Pattern Recognition (RPR) data analysis techniques

• Optimize window functions in SQL Server and Azure SQL Database, making the most of indexing, parallelism, and more

• Discover a full library of window function solutions for common business problems

 

About This Book

• For developers, DBAs, data analysts, data scientists, BI professionals, and power users familiar with T-SQL queries

• Addresses any edition of the SQL Server 2019 database engine or later, as well as Azure SQL Database

 

Get all code samples at:

MicrosoftPressStore.com/TSQLWindowFunctions/downloads