15
Fundamentals of Database Systems 5th Edition Ramez Elmasri Department of Computer Science and Engineering The University of Texas at Arlington Shamkant B. Navathe College of Computing Georgia Institute of Technology PEARSON Addison Wesley Boston San Francisco New York London Toronto Sydney Tokyo Singapore Madrid Mexico City Munich Paris Cape Town Hong Kong Montreal

Fundamentals of Database Systems - GBV

  • Upload
    others

  • View
    13

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Fundamentals of Database Systems - GBV

Fundamentals of

Database Systems 5th Edition

Ramez Elmasri Department of Computer Science and Engineering The University of Texas at Arlington

Shamkant B. Navathe College of Computing Georgia Institute of Technology

PEARSON

Addison Wesley

Boston San Francisco New York

London Toronto Sydney Tokyo Singapore Madrid

Mexico City Munich Paris Cape Town Hong Kong Montreal

Page 2: Fundamentals of Database Systems - GBV

Contents

• part 1 Introduction and Conceptual Modeling •

chapter T Databases and Database Users 3

1.1 Introduction 4

1.2 An Example 6

1.3 Characteristics of the Database Approach 9

1.4 Actors on the Scene 14

1.5 Workers behind the Scene 16

1.6 Advantages of Using the DBMS Approach 17

1.7 A Brief History of Database Applications 23

1.8 When Not to Use a DBMS 26

1.9 Summary 27

Review Questions 27

Exercises 28 Selected Bibliography 28

chapter 2 Database System Concepts and Architecture 29

2.1 Data Models, Schemas, and Instances 30

2.2 Three-Schema Architecture and Data Independence 33

xv

Page 3: Fundamentals of Database Systems - GBV

xvi Contents

2.3 Database Languages and Interfaces 36

2.4 The Database System Environment 40

2.5 Centralized and Client/Server Architectures for DBMSs 44

2.6 Classification of Database Management Systems 49

2.7 Summary 52

Review Questions 54

Exercises 54

Selected Bibliography 55

chapter 3 Data Modeling Using the Entity-Relationship (ER) Model 57

3.1 Using High-Level Conceptual Data Models for Database Design 59

3.2 An Example Database Application 60

3.3 Entity Types, Entity Sets, Attributes, and Keys 61

3.4 Relationship Types, Relationship Sets, Roles, and Structural Constraints 70

3.5 Weak Entity Types 76

3.6 Refining the ER Design for the COMPANY Database 78

3.7 ER Diagrams, Naming Conventions, and Design Issues 79

3.8 Example of Other Notation: UML Class Diagrams 84

3.9 Relationship Types of Degree Higher Than Two 86

3.10 Summary 90

Review Questions 91

Exercises 92

Laboratory Exercises 99

Selected Bibliography 101

chapter 4 The Enhanced Entity-Relationship (EER) Model 103

4.1 Subclasses, Superclasses, and Inheritance 104

4.2 Specialization and Generalization 106

4.3 Constraints and Characteristics of Specialization and Generalization Hierarchies 109

4.4 Modeling of UNION Types Using Categories 116

4.5 An Example UNIVERSITY EER Schema, Design Choices, and Formal Definitions 119

Page 4: Fundamentals of Database Systems - GBV

Contents xvii

4.6 Example of Other Notation: Representing Specialization and Generalization in UML Class Diagrams 1 23

4.7 Data Abstraction, Knowledge Representation, and Ontology Concepts 1 25

4.8 Summary 131

Review Questions 131

Exercises 132

Laboratory Exercises 140

Selected Bibliography 142

-part2 Relational Model: Concepts, Constraints, Languages, Design, and Programming

chapter O The Relational Data Model and Relational Database Constraints 145

5.1 Relational Model Concepts 146

5.2 Relational Model Constraints and Relational Database Schemas 153

5.3 Update Operations, Tranactions, and Dealing with Constraint Violations 161

5.4 Summary 165

Review Questions 166

Exercises 166

Selected Bibliography 170

chapter O The Relational Algebra and Relational Calculus 173

6.1 Unary Relational Operations: SELECT and PROJECT 175

6.2 Relational Algebra Operations from Set Theory 180

6.3 Binary Relational Operations: JOIN and DIVISION 183

6.4 Additional Relational Operations 192

6.5 Examples of Queries in Relational Algebra 199

6.6 The Tuple Relational Calculus 201

Page 5: Fundamentals of Database Systems - GBV

xviii Contents

6.7 The Domain Relational Calculus 210

6.8 Summary 212

Review Questions 213

Exercises 214

Laboratory Exercises 219

Selected Bibliography 221

chapter 7 Relational Database Design by ER-and EER-to-Relational Mapping 223

7.1 Relational Database Design Using ER-to-Relational Mapping 224

7.2 Mapping EER Model Constructs to Relations 232

7.3 Summary 236

Review Questions 236

Exercises 237

Laboratory Exercises 238

Selected Bibliography 239

chapter 8 SQL-99: Schema Definition, Constraints, Queries, and Views 241

8.1 SQL Data Definition and Data Types 243

8.2 Specifying Constraints in SQL 248

8.3 Schema Change Statements in SQL 251

8.4 Basic Queries in SQL 253

8.5 More Complex SQL Queries 263

8.6 INSERT, DELETE, and UPDATE Statements in SQL 279

8.7 Specifying Constraints as Assertions and Triggers 282

8.8 Views (Virtual Tables) in SQL 283

8.9 Additional Features of SQL 287

8.10 Summary 288

Review Questions 288

Exercises 290

Laboratory Exercises 293

Selected Bibliography 297

Page 6: Fundamentals of Database Systems - GBV

Contents xix

chapter 9 Introduction to SQL Programming Techniques 299

9.1 Database Programming: Issues and Techniques 300

9.2 Embedded SQL, Dynamic SQL, and SQLJ 303

9.3 Database Programming with Function Calls: SQL/CLI and JDBC 315

9.4 Database Stored Procedures and SQL/PSM 325

9.5 Summary 328

Review Questions 328

Exercises 329

Laboratory Exercises 329

Selected Bibliography 331

• part O Database Design Theory and Methodology •

chapter 1 O Functional Dependencies and Normalization for Relational Databases 335

10.1 Informal Design Guidelines for Relation Schemas 337

10.2 Functional Dependencies 347

10.3 Normal Forms Based on Primary Keys 355

10.4 General Definitions of Second and Third Normal Forms 365

10.5 Boyce-Codd Normal Form 368

10.6 Summary 370

Review Questions 371

Exercises 372

Laboratory Exercises 377

Selected Bibliography 377

chapter 11 1 Relational Database Design Algorithms and Further Dependencies 379

11.1 Properties of Relational Decompositions 380

11.2 Algorithms for Relational Database Schema Design 386

Page 7: Fundamentals of Database Systems - GBV

xx Contents

11.3 Multivalued Dependencies and Fourth Normal Form 396

11.4 Join Dependencies and Fifth Normal Form 402

11.5 Inclusion Dependencies 403

11.6 Other Dependencies and Normal Forms 404

11.7 Summary 407

Review Questions 407

Exercises 408

Laboratory Exercises 410

Selected Bibliography 411

chapter 1 2 Practical Database Design Methodology and Use of UML Diagrams 413

12.1 The Role of Information Systems in Organizations 414

12.2 The Database Design and Implementation Process 419

12.3 Use of UML Diagrams As an Aid to Database Design Specification 438

1 2.4 Rational Rose, a UML-Based Design Tool 447

1 2.5 Automated Database Design Tools 453

12.6 Summary 456

Review Questions 457

Selected Bibliography 459

part 4 Data Storage, Indexing, Query Processing, and Physical Design •

chapter 1 3 Disk Storage, Basic File Structures, and Hashing 463

13.1 Introduction 464

13.2 Secondary Storage Devices 467

13.3 Buffering of Blocks 473

13.4 Placing File Records on Disk 475

Page 8: Fundamentals of Database Systems - GBV

Contents xxi

13.5 Operations on Files 479

13.6 Files of Unordered Records (Heap Files) 482

13.7 Files of Ordered Records (Sorted Files) 483

13.8 Hashing Techniques 486

13.9 Other Primary File Organizations 496

13.10 Parallelizing Disk Access Using RAID Technology 497

13.11 New Storage Systems 500

13.12 Summary 503

Review Questions 504

Exercises 505

Selected Bibliography 509

chapter 1 4 Indexing Structures for Files 511

14.1 Types of Single-Level Ordered Indexes 512

14.2 Multilevel Indexes 522

14.3 Dynamic Multilevel Indexes Using B-Trees and B+-Trees 525

14.4 Indexes on Multiple Keys 538

14.5 Other Types of Indexes 542

14.6 Summary 543

Review Questions 544

Exercises 545

Selected Bibliography 547

chapter 1 5 Algorithms for Query Processing and Optimization 549

15.1 Translating SQL Queries into Relational Algebra 551

15.2 Algorithms for External Sorting 552

15.3 Algorithms for SELECT and JOIN Operations 554

15.4 Algorithms for PROJ ECT and SET Operations 565

15.5 Implementing Aggregate Operations and OUTER JOINS 566

15.6 Combining Operations Using Pipelining 568

15.7 Using Heuristics in Query Optimization 568

15.8 Using Selectivity and Cost Estimates in Query Optimization 578

15.9 Overview of Query Optimization in Oracle 588

Page 9: Fundamentals of Database Systems - GBV

xxii Contents

15.10 Semantic Query Optimization 589

15.11 Summary 589

Review Questions 590

Exercises 590

Selected Bibliography 591

chapter 1 6 Physical Database Design and Tuning 593

16.1 Physical Database Design in Relational Databases 593

16.2 An Overview of Database Tuning in Relational Systems 598

16.3 Summary 604

Review Questions 604

Selected Bibliography 605

pdrt ö Transaction Processing Concepts •

chapter 1 7 Introduction to Transaction Processing Concepts and Theory 609

17.1 Introduction to Transaction Processing 610

17.2 Transaction and System Concepts 616

17.3 Desirable Properties of Transactions 619

17.4 Characterizing Schedules Based on Recoverability 621

17.5 Characterizing Schedules Based on Serializability 624

17.6 Transaction Support in SQL 634

17.7 Summary 636

Review Questions 637

Exercises 638

chapter 1 0 Concurrency Control Techniques 641

18.1 Two-Phase Locking Techniques for Concurrency Control 642

18.2 Concurrency Control Based on Timestamp Ordering 652

18.3 Multiversion Concurrency Control Techniques 655

18.4 Validation (Optimistic) Concurrency Control Techniques 657

Page 10: Fundamentals of Database Systems - GBV

Contents xxiii

18.5 Granularity of Data Items and Multiple Granularity Locking 659

18.6 Using Locks for Concurrency Control in Indexes 663

18.7 Other Concurrency Control Issues 664

18.8 Summary 665

Review Questions 666

Exercises 667

Selected Bibliography 668

chapter 1 9 Database Recovery Techniques 669

19.1 Recovery Concepts 670

19.2 Recovery Techniques Based on Deferred Update 676

19.3 Recovery Techniques Based on Immediate Update 681

19.4 Shadow Paging 682

19.5 The ARIES Recovery Algorithm 684

19.6 Recovery in Multidatabase Systems 687

19.7 Database Backup and Recovery from Catastrophic Failures 689

19.8 Summary 689

Review Questions 690

Exercises 691

Selected Bibliography 694

• part 6 Object and Object-Relational Databases •

chapter 20 Concepts for Object Databases 699

20.1 Overview of Object-Oriented Concepts 701

20.2 Object Identity, Object Structure, and Type Constructors 703

20.3 Encapsulation of Operations, Methods, and Persistence 709

20.4 Type and Class Hierarchies and Inheritance 714

20.5 Complex Objects 718

20.6 Other Objected-Oriented Concepts 720

20.7 Summary 723

Review Questions 724

Exercises 724

Page 11: Fundamentals of Database Systems - GBV

xxiv Contents

chapter 21 Object Database Standards, Languages, and Design 727

21.1 Overview of the Object Model o f O D M G 728

21.2 The Object Definition Language ODL 741

21.3 The Object Query Language OQL 746

21.4 Overview of the C++ Language Binding 755

21.5 Object Database Conceptual Design 757

21.6 Summary 760

Review Questions 761

Exercises 761

Selected Bibliography 762

chapter 22 Object-Relational and Extended-Relational Systems 763

22.1 Overview of SQL and Its Object-Relational Features 764

22.2 Evolution of Data Models and Current Trends of Database Technology 771

22.3 The Informix Universal Server 773

22.4 Object-Relational Features of Oracle 8 784

22.5 Implementation and Related Issues for Extended Type Systems 786

22.6 The Nested Relational Model 788

22.7 Summary 790

Selected Bibliography 791

» part 7 Further Topics: Security, Advanced Modeling, and Distribution •

chapter 23 Database Security 795

23.1 Introduction to Database Security Issues 795

23.2 Discretionary Access Control Based on Granting and Revoking Privileges 800

23.3 Mandatory Access Control and Role-Based Access Control for Multilevel Security 804

Page 12: Fundamentals of Database Systems - GBV

23.4 Introduction to Statistical Database Security 810

23.5 Introduction to Flow Control 812

23.6 Encryption and Public Key Infrastructures 814

23.7 Privacy Issues and Preservation 816

23.8 Challenges of Database Security 817

23.9 Summary 818

Review Questions 819

Exercises 820

chapter 24 Enhanced Data Models for Advanced Applications 823

24.1 Active Database Concepts and Triggers 825

24.2 Temporal Database Concepts 835

24.3 Spatial and Multimedia Databases 849

24.4 Introduction to Deductive Databases 852

24.5 Summary 866

Review Questions 867

Exercises 868

Selected Bibliography 871

chapter 2 5 Distributed Databases and Client-Server Architectures 873

25.1 Distributed Database Concepts 874

25.2 Data Fragmentation, Replication, and Allocation Techniques for Distributed Database Design 880

25.3 Types of Distributed Database Systems 887

25.4 Query Processing in Distributed Databases 890

25.5 Overview of Concurrency Control and Recovery in Distributed Databases 895

25.6 An Overview of 3-Tier Client-Server Architecture 899

25.7 Distributed Databases in Oracle 901

25.8 Summary 904

Review Questions 904

Exercises 905

Selected Bibliography 907

Page 13: Fundamentals of Database Systems - GBV

part 8 Emerging Technologies •

chapter 26 Web Database Programming Using PHP

26.1 Structured, Semistructured, and Unstructured Data 914

26.2 A Simple PHP Example 919

26.3 Overview of Basic Features of PHP 921

26.4 Overview of PHP Database Programming 928

26.5 Summary 932

Review Questions 933

Exercises 933

Laboratory Exercises 934

Selected Bibliography 935

chapter 27 XML: Extensible Markup Language 937 27.1 XML Hierarchical (Tree) Data Model 938

27.2 XML Documents, DTD, and XML Schema 939

27.3 XML Documents and Databases 948

27.4 XMLQuerying 955

27.5 Summary 957

Review Questions 958

Exercises 958

Selected Bibliography 958

chapter 28 Data Mining Concepts 959 28.1 Overview of Data Mining Technology 960

28.2 Association Rules 963

28.3 Classification 975

28.4 Clustering 978

28.5 Approaches to Other Data Mining Problems 981

Page 14: Fundamentals of Database Systems - GBV

Conents xxvii

28.6 Applications of Data Mining 984

28.7 Commercial Data Mining Tools 984

28.8 Summary 987

Review Questions 987

Exercises 988

Selected Bibliography 989

chapter 29 Overview of Data Warehousing and OLAP 991

29.1 Introduction, Definitions, and Terminology 991

29.2 Characteristics of Data Warehouses 993

29.3 Data Modeling for Data Warehouses 994

29.4 Building a Data Warehouse 999

29.5 Typical Functionality of a Data Warehouse 1002

29.6 Data Warehouse versus Views 1003

29.7 Problems and Open Issues in Data Warehouses 1004

29.8 Summary 1006

Review Questions 1006

Selected Bibliography 1007

chapter 30 Emerging Database Technologies and Applications 1009

30.1 Mobile Databases 1010

30.2 Multimedia Databases 1017

30.3 Geographie Information Systems (GIS) 1024

30.4 Genome Data Management 1038

Selected Bibliography 1047

Credits 1050

appendix A Alternative Diagrammatic Notations for ER Models 1051

appendix B Parameters of Disks 1055

Page 15: Fundamentals of Database Systems - GBV

xxviii Contents

appendix C Overview of the QBE Language 1059

C.1 Basic Retrievals in QBE 1059

C.2 Grouping, Aggregation, and Database Modification in QBE 1064

appendix D Overview of the Hierarchical Data Model (located on the Companion Website at http://www.aw.com/elmasri)

appendix E Overview of the Network Data Model (located on the Companion Website at http://www.aw.com/elmasri)

Selected Bibliography 1067

Index 1097