Pro SQL Server 2008 Relational Database Design and Implementation (Pro)

This document was uploaded by one of our users. The uploader already confirmed that they had the permission to publish it. If you are author/publisher or own the copyright of this documents, please report to us by using this DMCA report form.

Simply click on the Download Book button.

Yes, Book downloads on Ebookily are 100% Free.

Sometimes the book is free on Amazon As well, so go ahead and hit "Search on Amazon"

Learn effective and scalable database design techniques in a SQL Server environment. Pro SQL Server 2008 Relational Database Design and Implementation covers everything from design logic that business users will understand all the way to the physical implementation of the design in a SQL Server database. Grounded in best practices and a solid understanding of the underlying theory, authors Louis Davidson, Kevin Kline, Scott Klein, and Kurt Windisch show how to “get it right” in SQL Server database design and lay a solid groundwork for the future use of valuable business data. Solid foundation in best practices and relational theory Maximize SQL Server features to enhance security, performance, scalability Thorough treatment from conceptual design to an effective, physical implementation What you’ll learn Develop conceptual models of client data using interviews and client documentation. Normalize data models to enhance scalability and the long term use of valuable data. Translate conceptual models into high–performing SQL Server databases. Secure and protect the integrity of data as part of meeting regulatory requirements. Take full advantage of new SQL Server features such as the spatial datatype, XML support, transparent data encryption, and more. Create effective indexing to speed query performance. Who is this book for? Pro SQL Server 2008 Relational Database Design and Implementation is designed for programmers of all types who want to use SQL Server 2008 to store data. Rookie database programmers will find a complete course on the fundamentals of database design that includes conceptual designs and physical implementation. Seasoned veterans will find many tips and tricks for implementing database systems that will be well worth the time invested in reading this book. About the Apress Pro Series The Apress Pro series books are practical, professional tutorials to keep you on and moving up the professional ladder. You have gotten the job, now you need to hone your skills in these tough competitive times. The Apress Pro series expands your skills and expertise in exactly the areas you need. Master the content of a Pro book, and you will always be able to get the job done in a professional development project. Written by experts in their field, Pro series books from Apress give you the hard–won solutions to problems you will face in your professional programming career.

Author(s): Louis Davidson, Kevin Kline, Scott Klein, Kurt Windisch
Edition: 1
Publisher: Apress
Year: 2008

Language: English
Pages: 665

Contents......Page 6
Foreword......Page 14
About the Author......Page 15
About the Technical Reviewers......Page 16
Acknowledgments......Page 17
Introduction......Page 19
CHAPTER 1: Introduction to Database Concepts......Page 23
Database Design Phases......Page 24
Conceptual......Page 25
Logical......Page 27
Implementation......Page 28
Relational Data Structures......Page 29
Tables, Rows, and Columns......Page 30
The Information Principle......Page 34
Domains......Page 37
Keys......Page 38
Missing Values (NULLs)......Page 44
Relationship Between Entities......Page 45
Data Access Language (SQL)......Page 51
Understanding Dependencies......Page 52
Determinant......Page 53
Summary......Page 54
Introduction to Data Modeling......Page 55
Entities......Page 57
Attributes......Page 60
Primary Keys......Page 61
Alternate Keys......Page 62
Domains......Page 64
Naming......Page 67
Relationships......Page 68
Nonidentifying Relationships......Page 69
Role Names......Page 72
Relationship Cardinality......Page 74
Verb Phrases (Relationship Names)......Page 81
Descriptive Information......Page 83
Alternative Modeling Methodologies......Page 84
Information Engineering......Page 85
Chen ERD......Page 87
Visio......Page 88
Management Studio Database Diagrams......Page 89
Best Practices......Page 90
Summary......Page 91
CHAPTER 3: Conceptual Data Modeling......Page 93
Understanding the Requirements......Page 94
Documenting the Process......Page 95
Requirements Gathering......Page 96
Client Interviews......Page 97
Questions to Be Answered......Page 98
Other Types of Documentation......Page 102
Identifying Objects and Processes......Page 104
Identifying Entities......Page 105
Relationships Between Entities......Page 113
Identifying Attributes and Domains......Page 120
Identifying Business Rules and Processes......Page 130
Identifying Business Rules......Page 131
Identifying Fundamental Processes......Page 132
Finishing the Conceptual Model......Page 134
Identifying Obvious Additional Data Needs......Page 135
Repeat Until the Customer Agrees with Your Model......Page 136
Summary......Page 137
CHAPTER 4: The Normalization Process......Page 138
Eliminating Duplicated Data......Page 139
Lowering the Number of Indexes Per Table......Page 140
The Process of Normalization......Page 141
All Attributes Must Be Atomic......Page 142
All Instances in an Entity Must Contain the Same Number of Values......Page 147
All Occurrences of an Entity Type in an Entity Must Be Different......Page 148
Programming Anomalies Avoided by First Normal Form......Page 149
Clues That An Existing Design Is Not in First Normal Form......Page 154
Relationships Between Attributes......Page 155
Second Normal Form......Page 156
Third Normal Form......Page 161
Boyce-Codd Normal Form......Page 168
Fourth Normal Form......Page 172
Fifth Normal Form......Page 186
Denormalization......Page 187
Summary......Page 188
Bonus Example......Page 189
The Story of the Book So Far......Page 196
CHAPTER 5: Implementing the Base Table Structures......Page 197
Transforming the Design......Page 201
Choosing Names......Page 202
Dealing with Subtypes......Page 206
Determining Tree Implementation......Page 210
Choosing Key Implementation......Page 211
Determining Domain Implementation......Page 218
Setting Up Schemas......Page 229
Reviewing the "Final" Implementation Model......Page 230
Implementing the Design......Page 231
Creating the Basic Table Structures......Page 232
Adding Uniqueness Constraints......Page 241
Building Default Constraints......Page 248
Adding Relationships (Foreign Keys)......Page 255
Dealing with Collations and Sorting......Page 266
Computed Columns......Page 271
Implementing User-Defined Datatypes......Page 274
Documenting Your Database......Page 283
Working with Dependency Information......Page 286
Best Practices......Page 290
Summary......Page 291
CHAPTER 6: Protecting the Integrity of Your Data......Page 292
Best Practices......Page 293
Automatic Data Protection......Page 295
Declarative Data Protection......Page 296
Basic Syntax......Page 298
CHECK Constraints Based on Simple Expressions......Page 300
CHECK Constraints Based on Functions......Page 302
Errors Caused by Constraints......Page 307
DML Triggers......Page 309
Handling Errors from Triggers and Constraints......Page 346
Manual Data Protection......Page 349
Stored Procedures......Page 351
Client Code......Page 353
More Best Practices......Page 356
Summary......Page 357
CHAPTER 7: Patterns and Query Techniques......Page 358
Precalculated Values......Page 359
Sequence Tables......Page 360
Calculations with Dates......Page 367
Binary Large Valued Objects (BLOB)......Page 376
Storing User-Specified Data......Page 379
Big Old List of Generic Columns......Page 381
Entity-Attribute-Value (EAV)......Page 382
Adding Columns to a Table......Page 386
Commonly Implemented Objects......Page 392
Anti-patterns......Page 393
One-Size-Fits-All Key Domain......Page 394
Generic Key References......Page 397
Overusing Unstructured Data......Page 400
Summary......Page 402
The Continuing Story of the Book So Far......Page 403
CHAPTER 8: Securing Access to the Data......Page 404
Principals and Securables......Page 406
Database Security Overview......Page 407
Impersonation......Page 408
Permissions......Page 410
Controlling Access to Objects......Page 412
Roles......Page 415
Schemas......Page 422
Controlling Object Access Via T-SQL Coded Objects......Page 424
Stored Procedures and Scalar Functions......Page 425
Impersonation Within Objects......Page 427
Crossing Database Lines......Page 432
Different Server (Distributed Queries)......Page 437
General Usage......Page 438
Implementing Configurable Row-Level Security with Views......Page 441
Obfuscating Data......Page 445
Monitoring and Auditing......Page 448
Server and Database Audit......Page 449
Watching Table History Using DML Triggers......Page 453
DDL Triggers......Page 457
Logging with Profiler......Page 460
Best Practices......Page 462
Summary......Page 463
CHAPTER 9: Table Structures and Indexing......Page 465
Files and Filegroups......Page 466
Extents and Pages......Page 470
Data on Pages......Page 472
Partitioning......Page 476
Basic Index Structure......Page 478
Index Types......Page 480
Clustered Indexes......Page 481
Nonclustered Indexes......Page 482
Nonclustered Indexes on Clustered Tables......Page 483
Basics of Index Creation......Page 486
Basic Index Usage Patterns......Page 488
Using Clustered Indexes......Page 490
Using Nonclustered Indexes......Page 492
Foreign Key Indexes......Page 505
Indexed Views......Page 510
Best Practices......Page 513
Summary......Page 514
CHAPTER 10: Coding for Concurrency......Page 516
What Is Concurrency?......Page 517
Query Optimization Basics......Page 518
OS and Hardware Issues......Page 521
Transactions......Page 522
Transaction Syntax......Page 523
Compiled SQL Server Code......Page 531
Locks......Page 539
Isolation Levels......Page 544
Pessimistic Locking......Page 556
Implementing a Single Threaded Code Block......Page 558
Optimistic Locking......Page 561
Row-Based Locking......Page 563
Logical Unit of Work......Page 567
Best Practices......Page 569
Summary......Page 570
CHAPTER 11: Considering Data Access Strategies......Page 571
Advantages......Page 573
Pitfalls......Page 581
Stored Procedures......Page 585
Encapsulation......Page 587
Dynamic Procedures......Page 588
Security......Page 590
Performance......Page 592
Pitfalls......Page 594
Opinions......Page 598
T-SQL and the CLR......Page 600
Guidelines for Choosing T-SQL......Page 604
CLR Object Types......Page 605
Best Practices......Page 608
Summary......Page 610
Rule 1: The Information Rule......Page 611
Rule 4: Dynamic Online Catalog Based on the Relational Model......Page 612
Rule 6: View Updating Rule......Page 613
Rule 8: Physical Data Independence......Page 614
Rule 9: Logical Data Independence......Page 615
Rule 12: Non-Subversion Rule......Page 616
Summary......Page 617
APPENDIX B: Scalar Datatype Reference......Page 618
Integer Values......Page 620
Decimal Values......Page 623
Approximate Numeric Data......Page 626
time [(precision)]......Page 628
datetime......Page 629
datetimeoffset [(precision)]......Page 630
Discussion on All Date Types......Page 631
char[(length)]......Page 634
varchar[(length)]......Page 635
varchar(max)......Page 636
Unicode Character Strings: nchar, nvarchar, nvarchar(max), ntext......Page 637
binary[(length)]......Page 638
varbinary(max)......Page 639
rowversion (a.k.a. timestamp)......Page 640
uniqueidentifier......Page 641
table......Page 644
sql_variant......Page 647
Not Simply Scalar Datatypes......Page 648
A......Page 650
C......Page 651
D......Page 653
F......Page 655
I......Page 656
M......Page 657
N......Page 658
P......Page 659
R......Page 660
S......Page 661
T......Page 663
U......Page 664
X......Page 665