An Introduction to Database Systems

Citation preview

Digitized by the Internet Archive in 2019 with funding from Kahle/Austin Foundation

https://archive.org/details/introductiontodaOOOOdesa

An Introduction to Database Systems

An Introduction to Database Systems

West Publishing Company St. Paul

New York

Los Angeles

San Francisco

Bipin C. Desai Concordia University Montreal, Canada

Copyeditor: Interior Design: Artwork: Compositor:

Sheryl Rose David Corona Design Rolin Graphics The Clarinda Company

COPYRIGHT © 1990 by WEST PUBLISHING COMPANY 610 Opperman Drive P.O. Box 64526 St. Paul, MN 55164-0526

All rights reserved Printed in the United States of America 97 96 95 94 93 92

8 7 6 5 4 3 2 1

Library of Congress Cataloging-in-Publication Data Desai, Bipin C. An introduction to database systems / Bipin C. Desai. p.

cm.

Includes bibliographical references. ISBN 0-314-66771-7 1. Data base management. QA76.9.D3D465 005.74—dc20

I. Title.

1990 89-22627 CIP

In memory of my parents

Preface xv

Chapter 2

Chapter 1 Basic Concepts

Data Models 34

1

1.1

Data Modeling for a Database 2

2.1

Introduction 35

1.1.1

Entities and Their Attributes

2.2

Data Associations 35

1.1.2

Relationships

Records and Files 7

2.2.1

Entities, Attributes, and Associations

1.2 1.3

Abstraction and Data Integration 9

3

7 36 2.2.2

Relationships among Entities

2.2.3

Representation of Associations and Relationships 44

41

1.4

The Three-Level Architecture Proposal for a DBMS 14

2.3

Data Models Classification 45

1.4.1

Mapping between Views

2.4

Entity-Relationship Model 46

1.4.2

Data Independence

2.4.1

Entities

1.5

Components of a DBMS 20

2.4.2

Relationships

2.4.3

Representation of Entities

1.5.1

Classification of DBMS Users

2.4.4

Representation of Relationship Set

1.5.2

DBMS Facilities

1.5.3

Structure of a DBMS

2.4.5

52 Generalization and Aggregation

1.5.4

Database Access

Advantages and Disadvantages of a DBMS 27

2.5

A Comparative Example 57

1.6

2.6

Relational Data Model 59

2.7

Network Data Model 63

2.8

Hierarchical Model 67

2.9

A Comparison 69

2.10

Summary 72

15

17

20

21 23

27

1.6.1

Advantages of a DBMS

1.6.2

Disadvantages of a DBMS

1.7

Summary 30 Key Terms 31 Exercises 32 Bibliographic Notes 33 Bibliography 33

27 29

47 49

Key Terms 72 Exercises 72

51

53

viii

Contents

Bibliographic Notes Bibliography 74

74

Chapter 3 File Organization1

Record Placement 134

3.10

Concluding Remarks 135

3.11

Summary 136 Key Terms 137 Exercises 138 Bibliographic Notes Bibliography 143

77

3.1

Introduction 78

3.1.1 3.1.2 3.1.3

Storage Device Characteristics 79 The Constituents of a File 82 Formal Specification of Storage of a File 84

3.1.4

Operations on Files: Logical Access 86

3.1.5

Primary Key Retrieval

3.2

Serial Files 91

3.3

Sequential Files 92

3.4

Index-Sequential Files 93

3.4.1 3.4.2 3.4.3

3.4.5

Implicit Index 94 Limit Indexing 94 Multilevel Indexing Schemes: Basic Technique 98 Structure of Index Sequential Files 100 VS AM 104

3.5

Direct File 105

3.5.1

Extendable Hashing

3.4.4

3.9

90

110

3.6

Secondary Key Retrieval 113

3.6.1 3.6.2 3.6.3 3.6.4

Inverted Index Files Multilist Files 118 Cellular Lists 122 Ring Files 123

3.7

143

Chapter 4 The Relational Model

145

4.1

Introduction 146

4.1.1

A Brief Review of Set Theory

4.2

Relational Database 153

4.2.1 4.2.2 4.2.3 4.2.4 4.2.5 4.2.6 4.2.7 4.2.8

Attributes and Domains 153 Tuples 155 Relations and Their Schemes Relation Representation 158 Keys 159 Relationship 160 Relational Operations 161 Integrity Rules 162

4.3

Relational Algebra 165

4.3.1 4.3.2

Basic Operations 165 Additional Relational Algebraic Operations 170 Some Relational Algebra Queries 179

115 4.3.3

151

157

4.4

Relational Calculus 184

Indexing Using Tree Structures 124

4.4.1 4.4.2

Tuple Calculus 187 Domain Calculus 193

3.7.1 3.7.2 3.7.3 3.7.4 3.7.5

Introduction 124 Tree Schemes 125 Operations 127 Capacity 132 B-trees 132

4.5

Concluding Remarks on Data Manipulation 198

4.6

Physical Implementation Issues 199

3.8

Logical and Physical Pointers 133

4.7

Summary 201

'May be skipped without loss of continuity.

Key Terms 202 Exercises 202 Bibliographic Notes 206 Bibliography 206

Contents

Chapter 5

5.10.4 Updates

Relational Database Manipulation 208

5.11 5.12

Introduction 209

5.2

SQL 212

5.2.1

Data Definition: SQL

5.3

Data Manipulation: SQL 214

5.3.1 5.3.2 5.3.3

5.3.5 5.3.6 5.3.7

Basic Data Retrieval 217 Condition Specification 218 Arithmetic and Aggregate Operators 219 SQL Join: Multiple Tables Queries 221 Set Manipulation 225 Categorization 233 Updates 235

5.4

Views: SQL 237

5.4.1

Views and Update

5.5

Remarks 242

5.6

QUEL 242

5.6.1

Data Definition

5.7

Data Manipulation: QUEL 24