Inside Microsoft SQL Server 2008: T-SQL Querying


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 ...
See more details below
$31.69 price
(Save 36%)$49.99 List Price

Pick Up In Store

Reserve and pick up in 60 minutes at your local store

Other sellers (Paperback)
  • All (8) from $18.13   
  • New (4) from $28.49   
  • Used (4) from $18.13   
Inside Microsoft SQL Server 2008: T-SQL Querying: T-SQL Querying

Available on NOOK devices and apps  
  • NOOK Devices
  • NOOK HD/HD+ Tablet
  • NOOK
  • NOOK Color
  • NOOK Tablet
  • Tablet/Phone
  • NOOK for Windows 8 Tablet
  • NOOK for iOS
  • NOOK for Android
  • NOOK Kids for iPad
  • PC/Mac
  • NOOK for Windows 8
  • NOOK for PC
  • NOOK for Mac
  • NOOK Study
  • NOOK for Web

Want a NOOK? Explore Now

NOOK Book (eBook)
$22.99 price
(Save 42%)$39.99 List Price


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
Read More Show Less

Product Details

  • ISBN-13: 9780735626034
  • Publisher: Microsoft Press
  • Publication date: 3/25/2009
  • Pages: 828
  • Sales rank: 514,310
  • Product dimensions: 7.30 (w) x 8.90 (h) x 1.90 (d)

Meet the Author

Itzik Ben-Gan is a principal mentor and a founder of SolidQ. A Microsoft MVP for SQL Server since 1999, Itzik teaches and consults internationally on T-SQL querying, programming, and query tuning. He has written numerous articles for SQL Server Magazine and MSDN, and speaks at industry events such as Microsoft TechEd, DevWeek, PASS, and SQL Server Connections.

Lubor Kollar is group program manager with the SQL Server Customer Advisory Team at Microsoft, working on the most challenging SQL Server deployments worldwide. He has 13+ years of experience with SQL Server development.

Dejan Sarka is a mentor with SolidQ and focuses on development of database and business intelligence applications. He is a frequent speaker at international conferences such as TechEd, SqlDevCon, and PASS. He is the founder of the Slovenian SQL Server and .NET Users Group. As main author or coauthor, Dejan has written nine books about SQL Server. He has also developed three courses for SolidQ: Data Modeling Essentials, Data Quality and Master Data Management, and Data Mining.

Steve Kass, PhD, is an MVP for SQL Server and a professor of mathematics and computer science. He has written for SQL Server Magazine and spoken at SQL Server Magazine Connections events.

Read More Show Less

Table of Contents

Hardware and Software Requirements;
Companion Content and Sample Database;
Find Additional Content Online;
Support for These Books;
Chapter 1: Logical Query Processing;
1.1 Logical Query Processing Phases;
1.2 Sample Query Based on Customers/Orders Scenario;
1.3 Logical Query Processing Phase Details;
1.4 Further Aspects of Logical Query Processing;
1.5 Conclusion;
Chapter 2: Set Theory and Predicate Logic;
2.1 An Example of English-to-Mathematics Translation;
2.2 Set Theory;
2.3 Predicate Logic;
2.4 Relations;
2.5 A Practical Application;
2.6 Conclusion;
Chapter 3: The Relational Model;
3.1 Introduction to the Relational Model;
3.2 Relational Algebra and Relational Calculus;
3.3 Data Integrity;
3.4 Normalization and Other Design Topics;
3.5 Conclusion;
Chapter 4: Query Tuning;
4.1 Sample Data for This Chapter;
4.2 Tuning Methodology;
4.3 Tools for Query Tuning;
4.4 Index Tuning;
4.5 Preparing Sample Data;
4.6 An Examination of Set-Based vs. Iterative/Procedural Approaches and a Tuning Exercise;
4.7 Conclusion;
Chapter 5: Algorithms and Complexity;
5.1 Do You Have a Quarter?;
5.2 How Algorithms Scale;
5.3 Classic Algorithms and Algorithmic Strategies;
5.4 A Practical Application;
5.5 Conclusion;
Chapter 6: Subqueries, Table Expressions, and Ranking Functions;
6.1 Subqueries;
6.2 Table Expressions;
6.3 Analytical Ranking Functions;
6.4 Auxiliary Table of Numbers;
6.5 Missing and Existing Ranges (Also Known as Gaps and Islands);
6.6 Conclusion;
Chapter 7: Joins and Set Operations;
7.1 Joins;
7.2 Set Operations;
7.3 Conclusion;
Chapter 8: Aggregating and Pivoting Data;
8.1 OVER Clause;
8.2 Tiebreakers;
8.3 Running Aggregations;
8.4 Pivoting;
8.5 Unpivoting;
8.6 Custom Aggregations;
8.7 Histograms;
8.8 Grouping Factor;
8.9 Grouping Sets;
8.10 Conclusion;
Chapter 9: TOP and APPLY;
9.2 APPLY;
9.3 Solutions to Common Problems Using TOP and APPLY;
9.4 Logical Transformations;
9.5 Conclusion;
Chapter 10: Data Modification;
10.1 Inserting Data;
10.2 Deleting Data;
10.3 Updating Data;
10.4 Merging Data;
10.5 OUTPUT Clause;
10.6 Conclusion;
Chapter 11: Querying Partitioned Tables;
11.1 Partitioning in SQL Server;
11.2 Conclusion;
Chapter 12: Graphs, Trees, Hierarchies, and Recursive Queries;
12.1 Terminology;
12.2 Scenarios;
12.3 Iteration/Recursion;
12.4 Materialized Path;
12.5 Materialized Path with the HIERARCHYID Data Type;
12.6 Nested Sets;
12.7 Transitive Closure;
12.8 Conclusion;
Appendix A: Logic Puzzles;
Puzzle Solutions;
About the Authors;
Itzik Ben-Gan;
Lubor Kollar;
Dejan Sarka;
Steve Kass;

Read More Show Less

Customer Reviews

Be the first to write a review
( 0 )
Rating Distribution

5 Star


4 Star


3 Star


2 Star


1 Star


Your Rating:

Your Name: Create a Pen Name or

Barnes & Review Rules

Our reader reviews allow you to share your comments on titles you liked, or didn't, with others. By submitting an online review, you are representing to Barnes & that all information contained in your review is original and accurate in all respects, and that the submission of such content by you and the posting of such content by Barnes & does not and will not violate the rights of any third party. Please follow the rules below to help ensure that your review can be posted.

Reviews by Our Customers Under the Age of 13

We highly value and respect everyone's opinion concerning the titles we offer. However, we cannot allow persons under the age of 13 to have accounts at or to post customer reviews. Please see our Terms of Use for more details.

What to exclude from your review:

Please do not write about reviews, commentary, or information posted on the product page. If you see any errors in the information on the product page, please send us an email.

Reviews should not contain any of the following:

  • - HTML tags, profanity, obscenities, vulgarities, or comments that defame anyone
  • - Time-sensitive information such as tour dates, signings, lectures, etc.
  • - Single-word reviews. Other people will read your review to discover why you liked or didn't like the title. Be descriptive.
  • - Comments focusing on the author or that may ruin the ending for others
  • - Phone numbers, addresses, URLs
  • - Pricing and availability information or alternative ordering information
  • - Advertisements or commercial solicitation


  • - By submitting a review, you grant to Barnes & and its sublicensees the royalty-free, perpetual, irrevocable right and license to use the review in accordance with the Barnes & Terms of Use.
  • - Barnes & reserves the right not to post any review -- particularly those that do not follow the terms and conditions of these Rules. Barnes & also reserves the right to remove any review at any time without notice.
  • - See Terms of Use for other conditions and disclaimers.
Search for Products You'd Like to Recommend

Recommend other products that relate to your review. Just search for them below and share!

Create a Pen Name

Your Pen Name is your unique identity on It will appear on the reviews you write and other website activities. Your Pen Name cannot be edited, changed or deleted once submitted.

Your Pen Name can be any combination of alphanumeric characters (plus - and _), and must be at least two characters long.

Continue Anonymously
Sort by: Showing all of 3 Customer Reviews
  • Anonymous

    Posted July 28, 2011

    No text was provided for this review.

  • Anonymous

    Posted March 15, 2011

    No text was provided for this review.

  • Anonymous

    Posted January 8, 2012

    No text was provided for this review.

Sort by: Showing all of 3 Customer Reviews

If you find inappropriate content, please report it to Barnes & Noble
Why is this product inappropriate?
Comments (optional)