data modelling

8
Data Modeling A Beginners Guide Andy Oppel TECHNISCHE INFORMATIONSBtBUOTHEK UNIVERSITATSBiBLIOTHEK HANNOVER Mc Gravu Hill New York Chicago San Francisco Lisbon London Madrid Mexico City Milan New Delhi San Juan Seoul Singapore Sydney Toronto

Upload: mahmut

Post on 11-Nov-2015

9 views

Category:

Documents


1 download

DESCRIPTION

Data Modelling

TRANSCRIPT

  • Data ModelingA Beginners Guide

    Andy Oppel

    TECHNISCHE

    INFORMATIONSBtBUOTHEK

    UNIVERSITATSBiBLIOTHEK

    HANNOVER

    McGravuHill

    New York Chicago San FranciscoLisbon London Madrid Mexico CityMilan New Delhi San Juan

    Seoul Singapore Sydney Toronto

  • Contents

    ACKNOWLEDGMENTS xvii

    INTRODUCTION xix

    PART I Data Modeling Concepts

    1 Introduction to Data Modeling 3Data-Centric Design 4Anatomy of a Data Model 6

    Layers of Data Abstraction 6Types ofData Models 8

    Importance of Data Modeling 12Documentation of Business Rules 12

    Visualization 12

    Illustration of Alternatives 13

    Foundation for Future Expansion 13Promotion of Common and Standard Structures 13

    Provisions for Automation 13

    Measures of a Good Data Model 14

    Enforcement of Business Rules 14

    Flexible and Adaptable 15

    ix

  • X Dafp Modeling: A Beginner's .Guide

    Easily Understood 15Balanced Perspective 15Promotion of Data Reusability 16Data Integration 16

    How Data Models Fit Into Application Development 16

    Process-Oriented Methodologies 16

    Data-Oriented Methodologies 17

    Hybrid Methodologies 17

    Object-Oriented Methodologies 17

    Prototyping Methodologies 17

    Agile Methodologies 18Data Modeling Participants 18

    Try This 1 -1: Refining a Conceptual Model 19

    Chapter 1 SelfTest 20

    2 Relational Model Components 23

    Conceptual and Logical Model Components 24Entities 25

    Attributes 30

    Relationships 32Business Rules 39

    Physical Model Components 39Tables 39

    Columns and Data Types 41Constraints 43

    Integrity Constraints 46Views 48

    Try This 2-1: Conceptual Model Modification 48Chapter 2 SelfTest 50

    3 Data and Process Modeling S3Data Model Diagramming Alternatives 54

    ERD Formats 54

    Representing Supertypes and Subtypes 60Guidelines for Drawing ERDs 63

    Process Models 63The Flowchart 64The Function Hierarchy Diagram 66The Swim Lane Diagram 67The Data Flow Diagram 68

  • Contents xi

    Unified Modeling Language (UML) 70UML Class Diagrams 70

    Other UML Diagrams 72

    Relating Entities and Processes 73

    Try This 3-1: Drawing a Conceptual Model with Nested Subtypes 75

    Chapter 3 Self Test 76

    4 Organizing Database Project Work 81

    The Traditional Life Cycle 82

    Planning 84

    Requirements Gathering 85

    Conceptual Design 88

    Logical Design 89

    Physical Design 89

    Construction 90

    Implementation and Rollout 90

    Ongoing Support 91

    Nontraditional Life Cycles 92

    Prototyping 92

    Rapid Application Development 93

    The Project Triangle 93

    Try This 4-1: Project Database Management Tasks 94

    Chapter 4 SelfTest 96

    PART II Data Modeling Details

    5 Conceptual Data Modeling 101

    The Conceptual Modeling Process 102

    Preparation 102

    Solution Design 105

    What Differentiates Conceptual Modeling from Logical Modeling? 105

    Creating the Model 106

    Generic Models and Patterns 106

    Roles vs. Subtypes 109

    Dealing with Hierarchies, Networks, and Linked Lists 113

    Bottom Up vs. Top Down Modeling 118

    Subject Areas 122

    Evaluating the Model 123

    What Makes a Good Conceptual Model? 123

    Try This 5-1: Conceptual Model for International Addresses 124

    Chapter 5 SelfTest 125

  • xii Data Modeling: A Beginner's.Guide

    6 Logical Database Design Using Normalization 127The Need for Normalization 130

    Insert Anomaly 130Delete Anomaly 130

    Update Anomaly 131

    Applying the Normalization Process 131

    Choosing a Primary Key 133First Normal Form: Eliminating Repeating Data 135

    Second Normal Form: Eliminating Partial Dependencies 137Third Normal Form: Eliminating Transitive Dependencies 139

    Denormalization 142

    Practice Problems 142

    Try This 6-1: UTLAAcademic Tracking 143

    The User Views 143

    Try This 6-2: Computer Books Company 146

    The User Views 146

    Chapter 6 Self Test 148

    7 Beyond Third Normal Form 151

    Advanced Normalization 152

    Boyce-Codd Normal Form 152Fourth Normal Form 155

    Fifth Normal Form 157

    Domain-Key Normal Form (DKNF) 158Resolving Supertypes and Subtypes 158Generalizing Attributes 162Alternatives for Reference Data 166

    Common Code Structures 166

    Crosswalk Tables 167

    Language Translation Tables 168

    Try This 7-1: Complex Logical Data Model 169Chapter 7 Self Test 171

    8 Physical Database Design 173The Physical Design Process 174

    Designing Tables 176

    Try This 8-1: Drawing a Physical Data Model 182

    Implementing Supertypes and Subtypes 183Naming Conventions 186

    Integrating Business Rules and Data Integrity 189NOT NULL Constraints 191

    Primary Key Constraints 191

  • Contents xiii

    Referential (Foreign Key) Constraints 191

    Unique Constraints 192Check Constraints 193

    Data Types, Precision, and Scale 193

    Triggers 194

    Adding Indexes for Performance 194

    Designing Views 196

    Try This 8-2: Mapping a Logical Model to a Physical Database Design 198

    Chapter 8 Self Test 199

    PART III Design Alternatives

    9 Alternatives for Incorporating Business Rules 205

    The Anatomy of a Business Rule 206The Origin of Business Rules 207

    Implementing Business Rules in Data Models 207

    Implementing Terms 207

    Implementing Facts 209

    Implementing Derivations 210

    Limitations on Implementing Business Rules in Data Models 211

    Implementing Constraints 211Constraints That Cannot Be Shown in Entity Relationship Models 212

    Functional Classification of Business Rules 214

    Definitional Rules 214

    Data Validation Rules 214

    Data Derivation Rules 215

    Cardinality Rules 215

    Referential Integrity Rules 215

    Process Rules 215

    Try This 9-1: Modeling Business Rules 216

    Chapter 9 Self Test 217

    10 Alternatives for Handling Temporal Data 219

    Temporal Data Structures 220When Does Time Matter? 220

    Adding History to Data Structures 221

    Processing Rules for History 228

    Handling Deletions 228

    Calendar Data Structures 230

    Business Rules for Temporal Data 231

    Try This 10-1: Adding History to Data Structures 233

    Chapter 10 Self Test 235

  • xiv Data Modeling:. A Beginner's .Guide.

    11 Modeling for Analytical Databases 237

    Data Warehouses 239

    OLTP Systems Compared with Data Warehouse Systems 240Data Warehouse Architecture 240

    Data Marts 245

    Modeling Analytical Data Structures 247OLAP Database Requirements 247Data Warehouse Modeling 248Data Mart Modeling 250

    Loading Data into Analytical Databases 257The Extract Process 258The Transform Process 258The Load Process 259

    TryThis 11-1: Design Star SchemaFact andDimension Tables 259Chapter 11 Self Test 261

    12 Enterprise Data Modeling 265

    Enterprise Data Management 266The Case for Data Management 266Alternatives to Centralized Data Management 267

    The Enterprise Data Model 268What Is an Enterprise Data Model? 268The Anatomy of an Enterprise Data Model 269Building an Enterprise Data Model 272

    TryThis 12-1: Enterprise Conceptual Model Development 274Chapter 12 Self Test 274

    PART IV Appendixes

    A Answers to Self Tests 279

    B Solutions to Try This Exercises 313TryThis 1-1: Refining a Conceptual Model 314Try This 2-1: Conceptual Model Modification 315

    Try This 3-1: Drawing a Conceptual Model with Nested Subtypes 316Try This 4-1: The Database Life Cycle 317

    Try This 5-1: Conceptual Model for International Addresses 318

    Try This 6-1: UTLA Academic Tracking 319Try This 6-2: Computer Books Company 322Try This 7-1: Complex Logical DataModel 324

    Try This 8-1: Drawing a Physical Data Model 325

  • Content? xv

    Try This 8-2: Mapping a Logical Model to a Physical Database Design 326

    Try This 9-1: Modeling Business Rules 326

    Try This 10-1: Adding History to Data Structures 327

    Try This 11-1: Design Star Schema Fact and Dimension Tables 328

    Try This 12-1: Enterprise Conceptual Model Development 329

    Index 331