Presentation is loading. Please wait.

Presentation is loading. Please wait.

Introduction to Database Design

Similar presentations


Presentation on theme: "Introduction to Database Design"— Presentation transcript:

1 Introduction to Database Design
Database Management Systems, 3rd ed., Ramakrishnan and Gehrke, Chapter 2

2 Figure 2.5: Roles Name SSN Lot Employees supervisor subordinate
ReportsTo 2

3 Relationship Cardinalities: Mappings
. . . . . . 1:1 1:N N:M 3

4 Key Constraint: 1:N FName SectNum CourseNum Room SSN Office Class
Teaches Faculty Each class has only one (at most one) instructor. 4

5 N:M Relationship SName SectNum CourseNum Room SSN Major Class Takes
Student More than 1 student may take a given class; more than 1 class may be taken by a given student. 5

6 1:1 Relationship Since Name FName SSN Office ID Major Faculty Mentors
Student Each faculty member may serve as the mentor for only 1 student; each student may have only 1 mentor. 6

7 Participation Constraint
Indicates whether existence of entity depends on its being related to another entity via a relationship set. Total participation constraint (existence dependency) – Every dependent entity must be related to an entity in the entity set on which it is dependent. Partial participation constraint – Some of the dependent entities are related to entities in the other entity set. 7

8 Example of Total Participation
FName DName MainOffice SSN Office Faculty WorksFor Department Participation constraint: Each faculty member must work for some (i.e., at least one) department. A faculty entity cannot exist without being assigned to a department. Key constraint: Each faculty member may work for at most one department. 8

9 Figure 2.11: Weak Entity Set
Name Cost PName Age SSN Lot Employees Policy Dependents Partial key is shown in blue rather than with a broken underline. 9

10 Figure 2.14: Entity vs. Attribute
DName Name To From DID Budget SSN Lot Employees WorksIn4 Departments Problem with this design: Does not allow an employee to work in a given department over more than one time period. 10

11 Figure 2.15: Entity vs. Attribute
DName Name DID Budget SSN Lot Employees WorksIn4 Departments From Duration To 11

12 ISA Hierarchy Name GPA ID Students Thesis Group ISA UnderGrads Grads
12

13 Figure 2.16 Name DBudget Since DName SSN DID Lot Budget Employees
Manages2 Departments What are the problems with this design? 13

14 Revised Figure 2.16 Name SSN Lot Employees DBudget DName ISA Since DID
Departments Other entity sets Manages2’ Managers 14

15 Figure 2.17 Name PName Age SSN Lot Dependents Employees Covers Cost
PolicyID Policies 15

16 Figure 2.17 Name PName Age SSN Lot Dependents Employees Covers
Beneficiary Policies Cost PolicyID 16

17 Subset of Figure 2.13 Departments PID StartedOn Projects PBudget
Sponsors DID Budget Since DName 17

18 Figure 2.13 Departments PID StartedOn Projects PBudget Sponsors DID
Since DName Monitors Employees Until SSN Name Lot 18

19 Figure 2.19 Name Lot SSN Employees StartedOn DName PBudget DID Budget
PID Projects Sponsors2 Departments 19

20 Another Aggregation Example
Information about applicants who have interviewed for a position at a company: CAddress ContactPhone CName Address ContactName Date Company Interview JobApplicant Phone SSN Name Fundamentals of Database Systems, Elmasri and Navathe 20

21 Example (continued) We want to associate a job offer with an interview. Why won’t this work? Company Interview JobApplicant JobOffer Attributes have been omitted for brevity. 21

22 Example (continued) Possible solution: Company Applied JobApplicant
ResultsIn JobOffer Interview 22

23 Example (continued) More desirable solution conceptually: JobApplicant
Company Interview ResultsIn JobOffer 23


Download ppt "Introduction to Database Design"

Similar presentations


Ads by Google