Chapter 10 Systems Development © 2008 Pearson Prentice Hall, Experiencing MIS, David Kroenke.
Chapter 8 Foundations of Relational Implementation David M. Kroenke Database Processing © 2000...
-
Upload
lindsay-may -
Category
Documents
-
view
241 -
download
4
Transcript of Chapter 8 Foundations of Relational Implementation David M. Kroenke Database Processing © 2000...
![Page 1: Chapter 8 Foundations of Relational Implementation David M. Kroenke Database Processing © 2000 Prentice Hall.](https://reader036.fdocuments.us/reader036/viewer/2022081504/56649f125503460f94c24d93/html5/thumbnails/1.jpg)
Chapter 8Foundations of Relational
Implementation
David M. Kroenke
Database Processing
© 2000 Prentice Hall
![Page 2: Chapter 8 Foundations of Relational Implementation David M. Kroenke Database Processing © 2000 Prentice Hall.](https://reader036.fdocuments.us/reader036/viewer/2022081504/56649f125503460f94c24d93/html5/thumbnails/2.jpg)
Chapter 8
© 2000 Prentice Hall
Review of Terminology
Relation “two-dimensional table”• entries are single value• attributes (columns) contain same type of
data• each attribute has a domain (allowed values)• no two rows are identical, order is unimportant• tuple (rows)
Page 193
![Page 3: Chapter 8 Foundations of Relational Implementation David M. Kroenke Database Processing © 2000 Prentice Hall.](https://reader036.fdocuments.us/reader036/viewer/2022081504/56649f125503460f94c24d93/html5/thumbnails/3.jpg)
Occurrence of a relationPATIENT(Name, DateOfBirth, Gender,
AccountNumber, Physician)
Page 194Figure 8-1 © 2000 Prentice Hall
![Page 4: Chapter 8 Foundations of Relational Implementation David M. Kroenke Database Processing © 2000 Prentice Hall.](https://reader036.fdocuments.us/reader036/viewer/2022081504/56649f125503460f94c24d93/html5/thumbnails/4.jpg)
Chapter 8
© 2000 Prentice Hall
Relational Schema
“The relation structure plus constraints on allowable data values”
Page 194
![Page 5: Chapter 8 Foundations of Relational Implementation David M. Kroenke Database Processing © 2000 Prentice Hall.](https://reader036.fdocuments.us/reader036/viewer/2022081504/56649f125503460f94c24d93/html5/thumbnails/5.jpg)
Chapter 8
© 2000 Prentice Hall
Key
“Group of one or more attributes that uniquely identifies a tuple in a relation”– logical– physical (index)
Page 194
![Page 6: Chapter 8 Foundations of Relational Implementation David M. Kroenke Database Processing © 2000 Prentice Hall.](https://reader036.fdocuments.us/reader036/viewer/2022081504/56649f125503460f94c24d93/html5/thumbnails/6.jpg)
Chapter 8
© 2000 Prentice Hall
Implementing a Relational Database
1. Define the database structure to the DBMS
2. Allocate media space3. Create the database data
Page 195
![Page 7: Chapter 8 Foundations of Relational Implementation David M. Kroenke Database Processing © 2000 Prentice Hall.](https://reader036.fdocuments.us/reader036/viewer/2022081504/56649f125503460f94c24d93/html5/thumbnails/7.jpg)
Chapter 8
© 2000 Prentice Hall
Data Definition Language
“The language used to describe the database structure”– tables– columns– indexes– constraints– security
Page 196
![Page 8: Chapter 8 Foundations of Relational Implementation David M. Kroenke Database Processing © 2000 Prentice Hall.](https://reader036.fdocuments.us/reader036/viewer/2022081504/56649f125503460f94c24d93/html5/thumbnails/8.jpg)
Chapter 8
© 2000 Prentice Hall
Relational Data Manipulation Language
• Relational Algebra• Relational Calculus• Transform-Oriented Languages• Query-by-Example; Query-by-Form
Page 198
![Page 9: Chapter 8 Foundations of Relational Implementation David M. Kroenke Database Processing © 2000 Prentice Hall.](https://reader036.fdocuments.us/reader036/viewer/2022081504/56649f125503460f94c24d93/html5/thumbnails/9.jpg)
DML Interfaces
• Forms
• Query/Update Language InterfaceSELECT Name, AgeFROM PATIENTWHERE Physician = ‘Levy’
Page 200
Figure 8-8
© 2000 Prentice Hall
![Page 10: Chapter 8 Foundations of Relational Implementation David M. Kroenke Database Processing © 2000 Prentice Hall.](https://reader036.fdocuments.us/reader036/viewer/2022081504/56649f125503460f94c24d93/html5/thumbnails/10.jpg)
Chapter 8
© 2000 Prentice Hall
DML Interfaces
• Stored Procedure InterfaceDO BILLING FOR BDATE = ‘9/15/1999’
• Application Program InterfaceCOBOLBASICPerlC++
Page 201
![Page 11: Chapter 8 Foundations of Relational Implementation David M. Kroenke Database Processing © 2000 Prentice Hall.](https://reader036.fdocuments.us/reader036/viewer/2022081504/56649f125503460f94c24d93/html5/thumbnails/11.jpg)
Relation Definitions
Page 204Figure 8-11a © 2000 Prentice Hall
![Page 12: Chapter 8 Foundations of Relational Implementation David M. Kroenke Database Processing © 2000 Prentice Hall.](https://reader036.fdocuments.us/reader036/viewer/2022081504/56649f125503460f94c24d93/html5/thumbnails/12.jpg)
Attribute Domains
Page 204Figure 8-11b © 2000 Prentice Hall
![Page 13: Chapter 8 Foundations of Relational Implementation David M. Kroenke Database Processing © 2000 Prentice Hall.](https://reader036.fdocuments.us/reader036/viewer/2022081504/56649f125503460f94c24d93/html5/thumbnails/13.jpg)
Domain Definitions
Page 204Figure 8-11c © 2000 Prentice Hall
![Page 14: Chapter 8 Foundations of Relational Implementation David M. Kroenke Database Processing © 2000 Prentice Hall.](https://reader036.fdocuments.us/reader036/viewer/2022081504/56649f125503460f94c24d93/html5/thumbnails/14.jpg)
Example Data
Figure 8-12 © 2000 Prentice Hall
![Page 15: Chapter 8 Foundations of Relational Implementation David M. Kroenke Database Processing © 2000 Prentice Hall.](https://reader036.fdocuments.us/reader036/viewer/2022081504/56649f125503460f94c24d93/html5/thumbnails/15.jpg)
Union“adding tuples from one relation to
those of a second” A+B
Page 205Figure 8-12 © 2000 Prentice Hall
![Page 16: Chapter 8 Foundations of Relational Implementation David M. Kroenke Database Processing © 2000 Prentice Hall.](https://reader036.fdocuments.us/reader036/viewer/2022081504/56649f125503460f94c24d93/html5/thumbnails/16.jpg)
Difference
“adding tuples that occur in the first relation but not the second” A-B
Page 206Figure 8-13 © 2000 Prentice Hall
![Page 17: Chapter 8 Foundations of Relational Implementation David M. Kroenke Database Processing © 2000 Prentice Hall.](https://reader036.fdocuments.us/reader036/viewer/2022081504/56649f125503460f94c24d93/html5/thumbnails/17.jpg)
Intersection
“contains tuples in both the first and second”
Page 206Figure 8-14 © 2000 Prentice Hall
![Page 18: Chapter 8 Foundations of Relational Implementation David M. Kroenke Database Processing © 2000 Prentice Hall.](https://reader036.fdocuments.us/reader036/viewer/2022081504/56649f125503460f94c24d93/html5/thumbnails/18.jpg)
Product
“selects specified attributes (columns) from a relation”
Page 206Figure 8-17 © 2000 Prentice Hall
![Page 19: Chapter 8 Foundations of Relational Implementation David M. Kroenke Database Processing © 2000 Prentice Hall.](https://reader036.fdocuments.us/reader036/viewer/2022081504/56649f125503460f94c24d93/html5/thumbnails/19.jpg)
Selection
“selects tuples (rows) from a relation”
Page 206Figure 8-18 © 2000 Prentice Hall
![Page 20: Chapter 8 Foundations of Relational Implementation David M. Kroenke Database Processing © 2000 Prentice Hall.](https://reader036.fdocuments.us/reader036/viewer/2022081504/56649f125503460f94c24d93/html5/thumbnails/20.jpg)
Chapter 8
© 2000 Prentice Hall
Join
“combination of the product, selection, and (possibly) projection operations”– equijoin– natural join– left outer join
Page 207
![Page 21: Chapter 8 Foundations of Relational Implementation David M. Kroenke Database Processing © 2000 Prentice Hall.](https://reader036.fdocuments.us/reader036/viewer/2022081504/56649f125503460f94c24d93/html5/thumbnails/21.jpg)
Equijoin, Natural, Left Outer
Page 209Figure 8-19 © 2000 Prentice Hall
![Page 22: Chapter 8 Foundations of Relational Implementation David M. Kroenke Database Processing © 2000 Prentice Hall.](https://reader036.fdocuments.us/reader036/viewer/2022081504/56649f125503460f94c24d93/html5/thumbnails/22.jpg)
Summary of Relational Algebra Operators
Page 209Figure 8-20 © 2000 Prentice Hall
![Page 23: Chapter 8 Foundations of Relational Implementation David M. Kroenke Database Processing © 2000 Prentice Hall.](https://reader036.fdocuments.us/reader036/viewer/2022081504/56649f125503460f94c24d93/html5/thumbnails/23.jpg)
Chapter 8
© 2000 Prentice Hall
Expressing Queries
1.What are the names of all students?
STUDENT [Name]
Page 210
![Page 24: Chapter 8 Foundations of Relational Implementation David M. Kroenke Database Processing © 2000 Prentice Hall.](https://reader036.fdocuments.us/reader036/viewer/2022081504/56649f125503460f94c24d93/html5/thumbnails/24.jpg)
Chapter 8
© 2000 Prentice Hall
Expressing Queries
2. What are the student numbers of all students enrolled in a class?
ENROLLMENT [StudentNumber]
Page 211
![Page 25: Chapter 8 Foundations of Relational Implementation David M. Kroenke Database Processing © 2000 Prentice Hall.](https://reader036.fdocuments.us/reader036/viewer/2022081504/56649f125503460f94c24d93/html5/thumbnails/25.jpg)
Chapter 8
© 2000 Prentice Hall
Expressing Queries
3. What are the student numbers of all students not enrolled in a class?
STUDENT [SID] - ENROLLMENT [StudentNumber]
Page 211
![Page 26: Chapter 8 Foundations of Relational Implementation David M. Kroenke Database Processing © 2000 Prentice Hall.](https://reader036.fdocuments.us/reader036/viewer/2022081504/56649f125503460f94c24d93/html5/thumbnails/26.jpg)
Chapter 8
© 2000 Prentice Hall
Expressing Queries
4. What are the numbers of students enrolled in the class ‘BD445’?ENROLLMENT WHERE ClassName = ‘BD445’[StudentNumber]
Page 211
![Page 27: Chapter 8 Foundations of Relational Implementation David M. Kroenke Database Processing © 2000 Prentice Hall.](https://reader036.fdocuments.us/reader036/viewer/2022081504/56649f125503460f94c24d93/html5/thumbnails/27.jpg)
Chapter 8
© 2000 Prentice Hall
Expressing Queries
5. What are the names of the students enrolled in class ‘BD445’?STUDENT JOIN (SID = StudentNumber) ENROLLMENT WHERE ClassName = ‘BD445’[STUDENT.Name]
Page 211
![Page 28: Chapter 8 Foundations of Relational Implementation David M. Kroenke Database Processing © 2000 Prentice Hall.](https://reader036.fdocuments.us/reader036/viewer/2022081504/56649f125503460f94c24d93/html5/thumbnails/28.jpg)
Chapter 8
© 2000 Prentice Hall
Expressing Queries
6. What are the names and meeting times of ‘PARKS’ classes?STUDENT WHERE Name = ‘PARKS’ JOIN (SID=StudentNumber) ENROLLMENT JOIN (ClassName = Name) CLASS [CLASS.Name, Time]
Page 212
![Page 29: Chapter 8 Foundations of Relational Implementation David M. Kroenke Database Processing © 2000 Prentice Hall.](https://reader036.fdocuments.us/reader036/viewer/2022081504/56649f125503460f94c24d93/html5/thumbnails/29.jpg)
Chapter 8
© 2000 Prentice Hall
Expressing Queries
7. What are the grade levels and meeting rooms of all students, including students not enrolled in a class?STUDENT LEFT OUTER JOIN (SID = StudentNumber) ENROLLMENT JOIN (ClassName = Name) CLASS [GradeLevel, Room]
Page 212