ER Model - United States Naval Academy€¦ · ER Model Entities, attributes, identifiers HAS-A...

13
1 1 IT420: Database Management and Organization ER Model: part 2 13 January 2006 Adina Crăiniceanu www.cs.usna.edu/~adina 2 ER Model Entities, attributes, identifiers HAS-A Relationships Degree: binary, ternary Maximum cardinality Minimum cardinality Weak entities ID-dependent entities; identifying relationships IS-A Relationships Inclusive, Exclusive 3 Goals of This Lecture Create ER model from user requirements

Transcript of ER Model - United States Naval Academy€¦ · ER Model Entities, attributes, identifiers HAS-A...

Page 1: ER Model - United States Naval Academy€¦ · ER Model Entities, attributes, identifiers HAS-A Relationships Degree: binary, ternary Maximum cardinality Minimum cardinality Weak

1

1

IT420: Database Management and Organization

ER Model: part 2 13 January 2006

Adina Crăiniceanuwww.cs.usna.edu/~adina

2

ER Model

Entities, attributes, identifiersHAS-A Relationships

Degree: binary, ternaryMaximum cardinalityMinimum cardinality

Weak entities ID-dependent entities; identifying relationships

IS-A RelationshipsInclusive, Exclusive

3

Goals of This Lecture

Create ER model from user requirements

Page 2: ER Model - United States Naval Academy€¦ · ER Model Entities, attributes, identifiers HAS-A Relationships Degree: binary, ternary Maximum cardinality Minimum cardinality Weak

2

4

ERwin Symbol Summary

5

ERwin Symbol Summary (Continued)

6

Forms, Reports and ER Model

User input: FormsReportsDiscussions

DB modeler: Entity-Relationship modelSame entities, relationships under the surface

Page 3: ER Model - United States Naval Academy€¦ · ER Model Entities, attributes, identifiers HAS-A Relationships Degree: binary, ternary Maximum cardinality Minimum cardinality Weak

3

7

1:1 Strong Entity Relationships

8

1:1 Strong Entity Relationships

9

1:N Strong Entity Relationships

Page 4: ER Model - United States Naval Academy€¦ · ER Model Entities, attributes, identifiers HAS-A Relationships Degree: binary, ternary Maximum cardinality Minimum cardinality Weak

4

10

1:N Strong Entity Relationships

11

N:M Strong Entity Relationships

12

N:M Strong Entity Relationships

Page 5: ER Model - United States Naval Academy€¦ · ER Model Entities, attributes, identifiers HAS-A Relationships Degree: binary, ternary Maximum cardinality Minimum cardinality Weak

5

13

N:M Strong Entity Relationships

14

The Association Pattern

Price column

15

Association Class

Page 6: ER Model - United States Naval Academy€¦ · ER Model Entities, attributes, identifiers HAS-A Relationships Degree: binary, ternary Maximum cardinality Minimum cardinality Weak

6

16

Entity vs. Attribute

17

Multi-valued Attribute Entity

18

Recursive Relationships

Recursive relationship: an entity has a relationship to itself

Page 7: ER Model - United States Naval Academy€¦ · ER Model Entities, attributes, identifiers HAS-A Relationships Degree: binary, ternary Maximum cardinality Minimum cardinality Weak

7

19

1:N Recursive Relationship

20

1:1 Recursive Relationship

21

N:M Recursive Relationship

Page 8: ER Model - United States Naval Academy€¦ · ER Model Entities, attributes, identifiers HAS-A Relationships Degree: binary, ternary Maximum cardinality Minimum cardinality Weak

8

22

Class Exercise

Draw ER diagram for a database used to manage IT420 class (at least 3 entities)

Specify entities, attributes, identifiersSpecify relationshipsSpecify cardinalities for relationships

23

Highline University

The Highline University [HU] database will track such entities as:

CollegesDepartmentsFacultyStudents

We have gathered a set of HU reports that will be the source documents for a data model

24

The College Report

Page 9: ER Model - United States Naval Academy€¦ · ER Model Entities, attributes, identifiers HAS-A Relationships Degree: binary, ternary Maximum cardinality Minimum cardinality Weak

9

25

Data Model from the College Report

26

The Department Report

27

The DEPARTMENT / PROFESSOR Relatioship:Alternate Model 1: Using a 1:N Relationship

Page 10: ER Model - United States Naval Academy€¦ · ER Model Entities, attributes, identifiers HAS-A Relationships Degree: binary, ternary Maximum cardinality Minimum cardinality Weak

10

28

The DEPARTMENT / PROFESSOR Relatioship:Alternate Model 1: Using a 1:N Relationship

29

The DEPARTMENT / PROFESSOR Relatioship:Alternate Model 2: Using an N:M Relationship

30

The DEPARTMENT / PROFESSOR Relatioship:Alternate Model 3: Using an Association Pattern

Page 11: ER Model - United States Naval Academy€¦ · ER Model Entities, attributes, identifiers HAS-A Relationships Degree: binary, ternary Maximum cardinality Minimum cardinality Weak

11

31

The DEPARTMENT / PROFESSOR Relatioship:Alternate Model 4: Using a Association Patternand a 1:N Relationship

Chaired By /Chairs

32

The Department Major Report

33

Data Model with STUDENT Entity

Chaired By /Chairs

Page 12: ER Model - United States Naval Academy€¦ · ER Model Entities, attributes, identifiers HAS-A Relationships Degree: binary, ternary Maximum cardinality Minimum cardinality Weak

12

34

The Student Acceptance Letter

35

Data Model with Advises Relationship

Chaired By /Chairs

36

Final Data Model

Chaired By /Chairs

Page 13: ER Model - United States Naval Academy€¦ · ER Model Entities, attributes, identifiers HAS-A Relationships Degree: binary, ternary Maximum cardinality Minimum cardinality Weak

13

37

ER Modeling: Case StudyDrugwarehouse.com has offered you a free life-time supply of prescription drugs (no questions asked) if you design its database schema. Given the rising cost of health care, you agree. Here is the information that you gathered:Patients are identified by their SSN, and we also store their names and ageDoctors are identified by their SSN, and we also store their names and specialtyEach patient has one primary care physicianEach doctor has at least one patientDoctors prescribe drugs for patients