ER Model IT420: Database Management and Organization ƒ

advertisement
IT420: Database Management and
Organization
ER Model: part 2
13 January 2006
Adina Crăiniceanu
www.cs.usna.edu/~adina
1
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
2
Goals of This Lecture
ƒ Create ER model from user requirements
3
1
ERwin Symbol Summary
4
ERwin Symbol Summary (Continued)
5
Forms, Reports and ER Model
ƒ User input:
ƒ Forms
ƒ Reports
ƒ Discussions
ƒ DB modeler: Entity-Relationship model
ƒ Same entities, relationships under the
surface
6
2
1:1 Strong Entity Relationships
7
1:1 Strong Entity Relationships
8
1:N Strong Entity Relationships
9
3
1:N Strong Entity Relationships
10
N:M Strong Entity Relationships
11
N:M Strong Entity Relationships
12
4
N:M Strong Entity Relationships
13
The Association Pattern
Price column
14
Association Class
15
5
Entity vs. Attribute
16
Multi-valued Attribute Æ Entity
17
Recursive Relationships
ƒ Recursive relationship: an entity has a
relationship to itself
18
6
1:N Recursive Relationship
19
1:1 Recursive Relationship
20
N:M Recursive Relationship
21
7
Class Exercise
ƒ Draw ER diagram for a database used to
manage IT420 class (at least 3 entities)
ƒ Specify entities, attributes, identifiers
ƒ Specify relationships
ƒ Specify cardinalities for relationships
22
Highline University
ƒ The Highline University [HU] database will
track such entities as:
ƒ
ƒ
ƒ
ƒ
Colleges
Departments
Faculty
Students
ƒ We have gathered a set of HU reports that
will be the source documents for a data
model
23
The College Report
24
8
Data Model from the College Report
25
The Department Report
26
The DEPARTMENT / PROFESSOR Relatioship:
Alternate Model 1: Using a 1:N Relationship
27
9
The DEPARTMENT / PROFESSOR Relatioship:
Alternate Model 1: Using a 1:N Relationship
28
The DEPARTMENT / PROFESSOR Relatioship:
Alternate Model 2: Using an N:M Relationship
29
The DEPARTMENT / PROFESSOR Relatioship:
Alternate Model 3: Using an Association Pattern
30
10
The DEPARTMENT / PROFESSOR Relatioship:
Alternate Model 4: Using a Association Pattern
and a 1:N Relationship
Chaired By /Chairs
31
The Department Major Report
32
Data Model with STUDENT Entity
Chaired By /Chairs
33
11
The Student Acceptance Letter
34
Data Model with Advises Relationship
Chaired By /Chairs
35
Final Data Model
Chaired By /Chairs
36
12
ER Modeling: Case Study
ƒ Drugwarehouse.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 age
ƒ Doctors are identified by their SSN, and we also store
their names and specialty
ƒ Each patient has one primary care physician
ƒ Each doctor has at least one patient
ƒ Doctors prescribe drugs for patients
37
13
Download