Presentation is loading. Please wait.

Presentation is loading. Please wait.

Chapter 8 Foundations of Relational Implementation David M. Kroenke Database Processing © 2000 Prentice Hall.

Similar presentations


Presentation on theme: "Chapter 8 Foundations of Relational Implementation David M. Kroenke Database Processing © 2000 Prentice Hall."— Presentation transcript:

1 Chapter 8 Foundations of Relational Implementation David M. Kroenke Database Processing © 2000 Prentice Hall

2 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

3 Occurrence of a relation PATIENT(Name, DateOfBirth, Gender, AccountNumber, Physician) Page 194 Figure 8-1 © 2000 Prentice Hall

4 Chapter 8 © 2000 Prentice Hall Relational Schema “The relation structure plus constraints on allowable data values” Page 194

5 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

6 Chapter 8 © 2000 Prentice Hall Implementing a Relational Database 1.Define the database structure to the DBMS 2.Allocate media space 3.Create the database data Page 195

7 Chapter 8 © 2000 Prentice Hall Data Definition Language “The language used to describe the database structure” –tables –columns –indexes –constraints –security Page 196

8 Chapter 8 © 2000 Prentice Hall Relational Data Manipulation Language Relational Algebra Relational Calculus Transform-Oriented Languages Query-by-Example; Query-by-Form Page 198

9 DML Interfaces Forms Query/Update Language Interface SELECT Name, Age FROM PATIENT WHERE Physician = ‘Levy’ Page 200 Figure 8-8 © 2000 Prentice Hall

10 Chapter 8 © 2000 Prentice Hall DML Interfaces Stored Procedure Interface DO BILLING FOR BDATE = ‘9/15/1999’ Application Program Interface COBOL BASIC Perl C++ Page 201

11 Relation Definitions Page 204 Figure 8-11a © 2000 Prentice Hall

12 Attribute Domains Page 204 Figure 8-11b © 2000 Prentice Hall

13 Domain Definitions Page 204 Figure 8-11c © 2000 Prentice Hall

14 Example Data Figure 8-12 © 2000 Prentice Hall

15 Union “adding tuples from one relation to those of a second” A+B Page 205 Figure 8-12 © 2000 Prentice Hall

16 Difference “adding tuples that occur in the first relation but not the second” A-B Page 206 Figure 8-13 © 2000 Prentice Hall

17 Intersection “contains tuples in both the first and second” Page 206 Figure 8-14 © 2000 Prentice Hall

18 Product “selects specified attributes (columns) from a relation” Page 206 Figure 8-17 © 2000 Prentice Hall

19 Selection “selects tuples (rows) from a relation” Page 206 Figure 8-18 © 2000 Prentice Hall

20 Chapter 8 © 2000 Prentice Hall Join “combination of the product, selection, and (possibly) projection operations” –equijoin –natural join –left outer join Page 207

21 Equijoin, Natural, Left Outer Page 209 Figure 8-19 © 2000 Prentice Hall

22 Summary of Relational Algebra Operators Page 209 Figure 8-20 © 2000 Prentice Hall

23 Chapter 8 © 2000 Prentice Hall Expressing Queries 1.What are the names of all students? STUDENT [Name] Page 210

24 Chapter 8 © 2000 Prentice Hall Expressing Queries 2. What are the student numbers of all students enrolled in a class? ENROLLMENT [StudentNumber] Page 211

25 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

26 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

27 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

28 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

29 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


Download ppt "Chapter 8 Foundations of Relational Implementation David M. Kroenke Database Processing © 2000 Prentice Hall."

Similar presentations


Ads by Google