Troubleshooting SQL

Troubleshooting SQL

Troubleshooting SQL

Troubleshooting SQL

Paperback

$49.00 
  • SHIP THIS ITEM
    Qualifies for Free Shipping
  • PICK UP IN STORE
    Check Availability at Nearby Stores

Related collections and offers


Overview

Explains optimizing SQL statements and procedures and creating a customized SQL debugging environment for error-free applications. This work includes programming tips and coverage of Oracle SQL and PL/SQL and T-SQL for SQL Server.

Product Details

ISBN-13: 9780072134896
Publisher: McGraw-Hill Companies, The
Publication date: 09/01/2001
Series: Application Development
Pages: 400
Product dimensions: 7.51(w) x 9.39(h) x 0.82(d)

Table of Contents

Part ILaying the Groundwork
Chapter 1Choosing a Troubleshooting Environment3
Query Analyzers8
Graphical Tools12
Development Environments16
Facing Reality17
Summary19
Chapter 2Using Best Practices21
A Guided Tour of Best Practices24
Make Your Code Self-Documenting24
Make Your Code Readable36
Undertake All Actions Explicitly38
Include Narrative Comments40
Stick to Supported Options40
Optimizing Queries41
Protecting Data44
Protecting Data Integrity45
Summary47
Chapter 3Preparing Your Troubleshooting Environment49
What to Have Handy50
What to Make Ready53
What to Set Up54
What to Run55
How to Run Your Environment57
Summary58
Part IIAnalyzing Problems
Chapter 4Creating Databases61
Troubleshooting Setup Problems62
Database Objects and User Relationships65
Organizing Tables68
Putting the Database on Disk78
Protecting Response Time82
Creating Indexes82
Archiving Data84
Managing Logs and Files85
Securing the Data88
Defining Users90
Defining Roles94
Summary97
Chapter 5Normalizing Tables99
Thirteen Rules101
First Normal Form105
Further Normal Forms108
Second Normal Form109
Third Normal Form110
Boyce-Codd Normal Form111
Fourth Normal Form112
Fifth Normal Form and Beyond113
Optimizing Tables115
Normalizing to Optimize115
Considering Denormalization116
Summary116
Chapter 6Using Data Types117
Using Data Types118
Numeric Data Types120
Time-Related Data Types123
Character Data Types126
Converting Data Types from One Database to Another129
Summary131
Chapter 7Selecting Data133
The Basic SELECT Statement135
Aggregates as Complicating Factors136
Joins as Complicating Factors139
WHERE Clauses as Complicating Factors141
A Look at a Complex Query142
A Few Practical Suggestions147
Summary148
Chapter 8Inserting Data149
The Basic INSERT Statement151
Inserting into Multiple Tables152
Common Complicating Factors154
Database Design154
Constraints156
Null Values158
Missing Values159
Multiple Values159
Examining a Complex INSERT Statement160
A Few Practical Suggestions167
Summary167
Chapter 9Updating Data169
Transactional Integrity170
The ACID Test171
Types of Locks174
Lock Granularity175
Optimistic and Pessimistic Locking176
Making Optimistic Locking Work176
Deadlocks178
Transaction Suggestions180
The Basic UPDATE Statement180
WHERE Is Your Best Friend181
Using the FROM Clause181
Updating to Calculated Values182
Things That Prevent Updates183
Undocumented Schemas184
Data Type Incompatibility184
Unique Primary Key Constraints185
Foreign Key Constraints187
Unique Index Constraints187
Allow Nulls and Defaults187
Check Constraints188
Triggers188
Views, with Check189
Security Settings189
Summary190
Chapter 10Deleting Data191
The Basic DELETE Statement192
Just in Case192
The Data Saving WHERE Clause193
FROM-FROM193
Things That Prevent Deletions194
Referential Integrity195
Optional Foreign Keys195
Cascade Deletes196
Cascade Delete Triggers197
Logical Deletion198
Logical Delete Flag198
Logical Delete Triggers199
Cascading Logical Deletes201
Truncating a Table202
Summary202
Chapter 11Grouping and Aggregating Data203
Common Aggregate Functions205
The COUNT() Function205
The SUM() Function208
The AVG() Function209
The MIN() and MAX() Functions209
GROUP BY210
Cleaning Up a GROUP BY Query211
The SQL Order with Aggregates213
Generating Cube Subtotals214
Recap215
Summary216
Chapter 12Using Joins217
The Join Within the SQL Statement219
Inner Joins219
Changes in the Resulting Row Count219
Working with Graphic Query Tools220
Execution Order of the SQL Statement221
Self Joins222
Outer Joins225
Right Outer Joins226
Data Scrubbing with Nulls226
Full Outer Joins227
An Eighteenth-Century Analogy227
Legacy Joins228
Cross Joins229
Union Joins229
Complex Joins230
Multiple Tables230
Multiple Join Conditions231
Non-Equal Join231
A Readable Style232
Summary232
Chapter 13Using Subqueries233
Subquery Basics234
Substituting Subqueries235
Substituting a Column Name236
Substituting a Column Value239
Dynamically Setting the Top Row Count241
Referencing a Derived Table242
Building a Dynamic WHERE Clause243
Altering the GROUP BY and ORDER BY245
Correlated Subqueries246
Summary247
Chapter 14Using Views249
Using Views251
Views to Project Columns252
Nesting Views252
Partitioned Views and Federated Databases255
Views as Security259
Using the WITH CHECK Option259
Problems with Views260
Speaking of Locks, Updates, and Views260
Performance261
Views Are Often Nonupdatable262
Schema Changes262
Debugging Difficulties263
Multiple Table References264
Editing Views264
Rebuilding Database Objects from Scripts265
Summary265
Part IIISolving Complex Problems
Chapter 15Triggers, Stored Procedures, and Parameters269
Why Use Triggers and Stored Procedures?271
Eliminating Code Troubles with Triggers and Stored Procedures271
Scenario272
Option 1: Modifying the Code276
Triggers277
Option 2: Using a Trigger279
Option 3: Using Stored Procedures279
Syntax and Types of Stored Procedures282
Debugging Stored Procedures284
Using Parameters286
What Are Parameters?286
Parameter Fundamentals288
Summary290
Chapter 16Transactions291
Transaction Processing Requirements293
Atomic293
Consistent293
Isolated294
Durable294
Transaction Fundamentals294
Database Locks295
Understanding Locks295
Using Locks297
Using Transactions298
Transactions in Oracle298
Controlling Transactions301
Transactions in Transact-SQL301
Transactions and Stored Procedures302
Monitoring Transactions: Using the Transaction Log303
Summary304
Chapter 17Using Cursors and Exceptions305
Understanding Cursors306
Creating and Using Cursors307
Cursors for Transact-SQL308
Creating SQL Cursors308
Opening Cursors309
Updating and Deleting Cursors311
Closing Cursors312
Understanding Cursors for PL/SQL313
Declaring a Cursor313
Exceptions in PL/SQL317
Exception Types317
Exception Handling319
RAISE and RAISE_APPLICATION_ERROR Statements320
Summary323
Chapter 18Trees325
Introducing Trees326
Understanding Trees and Hierarchies327
Rules for Trees332
Limits of the CONNECT BY Clause333
Extracting Information Within Trees335
Tree Operations336
Deleting a Subtree336
Subtree Incorporation337
Summary337
Index339
From the B&N Reads Blog

Customer Reviews