did-you-know? rent-now

Amazon no longer offers textbook rentals. We do!

did-you-know? rent-now

Amazon no longer offers textbook rentals. We do!

We're the #1 textbook rental company. Let us show you why.

9780735623132

Inside Microsoft SQL Server 2005 : T-SQL Querying

by ;
  • ISBN13:

    9780735623132

  • ISBN10:

    0735623139

  • Edition: 1st
  • Format: Paperback
  • Copyright: 2006-03-29
  • 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: $44.99

Summary

Take a detailed look at the internal architecture of T-SQLand unveil the power of set-based queryingwith comprehensive reference and advice from the experts. Database developers and administrators get best practices, sample databases, and code to master the intricacies of the programming languagesolving complex problems with real-world solutions.Discover how to: Understand logical and physical query processing Apply a methodology to optimize query tuning Solve relational division problems Use CTEs and ranking functions to simplify and optimize solutions Aggregate data with various techniques, including tiebreakers, pivoting, histograms, and grouping factors Use the TOP option in a query to modify data Query specialized data structures with recursive logic, materialized path, or nested sets solutions PLUSImprove your logic and get to the heart of querying problems with logic puzzlesGet code and database samples on the Web

Author Biography

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.

Table of Contents

Forewordp. xiii
Prefacep. xv
Acknowledgmentsp. xix
Introductionp. xxiii
Organization of This Bookp. xxiii
System Requirementsp. xxiii
Installing Sample Databasesp. xxiv
Updatesp. xxiv
Code Samplesp. xxiv
Support for This Bookp. xxiv
Logical Query Processingp. 1
Logical Query Processing Phasesp. 3
Brief Description of Logical Query Processing Phasesp. 4
Sample Query Based on Customers/Orders Scenariop. 4
Logical Query Processing Phase Detailsp. 6
Performing a Cartesian Product (Cross Join)p. 6
Applying the ON Filter (Join Condition)p. 8
Adding Outer Rowsp. 10
Applying the WHERE Filterp. 11
Groupingp. 12
Applying the CUBE or ROLLUP Optionp. 13
Applying the HAVING Filterp. 13
Processing the SELECT Listp. 14
Applying the DISTINCT Clausep. 15
Applying the ORDER BY Clausep. 15
Applying the TOP Optionp. 18
New Logical Processing Phases in SQL Server 2005p. 19
Table Operatorsp. 19
OVER Clausep. 27
Set Operationsp. 29
Conclusionp. 30
Physical Query Processingp. 31
Flow of Data During Query Processingp. 32
Compilationp. 35
Algebrizerp. 37
Optimizationp. 40
Working with the Query Planp. 47
Update Plansp. 59
Conclusionp. 63
Acknowledgmentp. 63
Query Tuningp. 65
Sample Data for This Chapterp. 66
Tuning Methodologyp. 69
Analyze Waits at the Instance Levelp. 71
Correlate Waits with Queuesp. 80
Determine Course of Actionp. 81
Drill Down to the Database/File Levelp. 82
Drill Down to the Process Levelp. 84
Tune Indexes/Queriesp. 103
Tools for Query Tuningp. 105
syscacheobjectsp. 105
Clearing the Cachep. 105
Dynamic Management Objectsp. 106
STATISTICS IOp. 106
Measuring the Run Time of Queriesp. 106
Analyzing Execution Plansp. 107
Hintsp. 119
Traces/Profilerp. 121
Database Engine Tuning Advisorp. 121
Index Tuningp. 122
Table and Index Structuresp. 122
Index Access Methodsp. 132
Index Optimization Scalep. 155
Fragmentationp. 168
Partitioningp. 170
Preparing Sample Datap. 170
Data Preparationp. 170
TABLESAMPLEp. 177
An Examination of Set-Based vs. Iterative/Procedural Approaches, and a Tuning Exercisep. 180
Additional Resourcesp. 187
Conclusionp. 189
Subqueries, Table Expressions, and Ranking Functionsp. 191
Subqueriesp. 191
Self-Contained Subqueriesp. 192
Correlated Subqueriesp. 195
Misbehaving Subqueriesp. 208
Uncommon Predicatesp. 209
Table Expressionsp. 211
Derived Tablesp. 211
Common Table Expressions (CTE)p. 214
Analytical Ranking Functionsp. 222
Row Numberp. 224
Rank and Dense Rankp. 246
NTILEp. 247
Auxiliary Table of Numbersp. 252
Existing and Missing Ranges (Also Known as Islands and Gaps)p. 256
Missing Ranges (Also Known as Gaps)p. 257
Existing Ranges (Also Known as Islands)p. 260
Conclusionp. 262
Joins and Set Operationsp. 263
Joinsp. 263
Old Style vs. New Stylep. 263
Fundamental Join Typesp. 264
Further Examples of Joinsp. 276
Sliding Total of Previous Yearp. 287
Join Algorithmsp. 291
Separating Elementsp. 296
Set Operationsp. 303
UNIONp. 304
EXCEPTp. 305
INTERSECTp. 307
Precedence of Set Operationsp. 309
Using INTO with Set Operationsp. 310
Circumventing Unsupported Logical Phasesp. 310
Conclusionp. 313
Aggregating and Pivoting Datap. 315
OVER Clausep. 315
Tiebreakersp. 319
Running Aggregationsp. 321
Cumulative Aggregationsp. 323
Sliding Aggregationsp. 328
Year-To-Date (YTD)p. 330
Pivotingp. 331
Pivoting Attributesp. 331
Relational Divisionp. 335
Aggregating Datap. 337
Unpivotingp. 341
Custom Aggregationsp. 344
Custom Aggregations Using Pivotingp. 345
User Defined Aggregates (UDA)p. 347
Specialized Solutionsp. 358
Histogramsp. 367
Grouping Factorp. 371
CUBE and ROLLUPp. 374
CUBEp. 374
Rollupp. 379
Conclusionp. 380
TOP and APPLYp. 381
SELECT TOPp. 381
TOP and Determinismp. 383
TOP and Input Expressionsp. 385
TOP and Modificationsp. 385
APPLYp. 388
Solutions to Common Problems Using TOP and APPLYp. 391
TOP n for Each Groupp. 391
Matching Current and Previous Occurrencesp. 397
Pagingp. 402
Random Rowsp. 411
Medianp. 413
Conclusionp. 415
Data Modificationp. 417
Inserting Datap. 417
SELECT INTOp. 417
INSERT EXECp. 419
Inserting New Rowsp. 423
INSERT with OUTPUTp. 426
Sequence Mechanismsp. 428
Deleting Datap. 435
TRUNCATE vs. DELETEp. 435
Removing Rows with Duplicate Datap. 435
DELETE Using Joinsp. 438
DELETE with OUTPUTp. 441
Updating Datap. 443
UPDATE Using Joinsp. 443
UPDATE with OUTPUTp. 447
SELECT and UPDATE Statement Assignmentsp. 450
Other Performance Considerationsp. 454
Conclusionp. 457
Graphs, Trees, Hierarchies, and Recursive Queriesp. 459
Terminologyp. 460
Graphsp. 460
Treesp. 461
Hierarchiesp. 461
Scenariosp. 462
Employee Organizational Chartp. 462
Bill of Materials (BOM)p. 464
Road Systemp. 468
Iteration/Recursionp. 471
Subordinatesp. 472
Ancestorsp. 484
Subgraph/Subtree with Path Enumerationp. 487
Sortingp. 491
Cyclesp. 502
Materialized Pathp. 505
Maintaining Datap. 506
Queryingp. 512
Nested Setsp. 517
Assigning Left and Right Valuesp. 518
Queryingp. 527
Transitive Closurep. 530
Directed Acyclic Graphp. 531
Conclusionp. 548
Logic Puzzlesp. 551
Puzzlesp. 551
Medication Tabletsp. 551
Chocolate Barp. 552
To a Tp. 552
On the Dotp. 553
Rectangles in a Squarep. 553
Measuring Time by Burning Ropesp. 553
Arithmetic Maximum Calculationp. 554
Covering a Chessboard with Domino Tilesp. 554
The Missing Buckp. 555
Flipping Lamp Switchesp. 555
Cutting a Stick to Make a Trianglep. 555
Rectangle Within a Circlep. 555
Monty Hall Problemp. 556
Piece of Cakep. 556
Cards Facing Upp. 556
Basic Arithmeticp. 557
Self-Replicating Code (Quine)p. 557
Hiking a Mountainp. 557
Find the Pattern in the Sequencep. 558
Puzzle Solutionsp. 558
Medication Tabletsp. 558
Chocolate Barp. 558
To a Tp. 558
On the Dotp. 559
Rectangles in a Squarep. 559
Measuring Time by Burning Ropesp. 561
Arithmetic Maximum Calculationp. 561
Covering a Chessboard with Domino Tilesp. 561
The Missing Buckp. 562
Alternating Lamp Statesp. 562
Cutting a Stick to Make a Trianglep. 562
Rectangle Within a Circlep. 563
Monty Hall Problemp. 563
Piece of Cakep. 565
Cards Facing Upp. 565
Basic Arithmeticp. 565
Self-Replicating Code (Quine)p. 566
Hiking a Mountainp. 566
Find the Pattern in the Sequencep. 567
Conclusionp. 567
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