Designing E/R Diagrams
Designing E/R Diagrams
2005
Person name
Is-insured
(n,m)
Wedding
T1
T2
occurred
Type T1 and T2 are overlapping; an entity can belong to both T1 and T2; default is disjoint
phone# to
T1
ssn
from ------amount
Optional Attribute T2
T3
T3=T2 T1
(1,1)
UGrad
gre
ssn
Student name
(1,1))
salary
mentor
(0,25) (0,2)
Grad
home
employs
(0,30) (0,*) (0,*)
(0,*)
took
(0,*)
Department name
Semester
grade
semesterid
gre
ssn
Student name
(1,*)
Grad
(0.*)
employs assoc
(0,75)
(0,*)
gpa
title Cou#
took
(0,*)
Department name
(0,*)
Semester
grade
Course
(0,*)
semesterid
(1,1) took-not-a-set: -1.5 Section not weak: -2 Other Errors: -0.5--1 if minor -23 if major
offered
Section
Time-offered
classroom
name
Month
from (0,*) (0,*) to
Sal
birthd
(0,*)
ssn
name Player
name
city Team
Home
(25,*)
contr
Visit
(0,*)
Contract set viol 3, Other: -2
(0,*)
(0,*) pos
play
played-in.
(1,1)
(18,*)
pos
score
Game
Date
Game#
A set of relationships (double diamond) or A set of relationships or a single attribute (dotted line) or A set of relationships and a set of attributes (dotted line)
Remark: min-max cardinalities for weak entity types for their participation in identifying relationships have to be (1,1)!!
Christoph F. Eick: Designing E/R Diagrams 9
ssn name
(0,*)
Male
occurred
(1,1)
husband wife
Person
(0,*)
Female
Wedding
(0,*)
(0,*)
Is-insured
Company
name
11
12
gpa
department
(0,*)
Name
worksfor
(0,*)
(0,*)
gender ssn
Person
wife husband
Company
salary
(0,*)
(0,*)
takes
(0,*)
is-marriedto
Section
time
Christoph F. Eick: Designing E/R Diagrams
S#
Course
C#
13
name ssn
Person
(0,*)
isinsured
(0,*)
Company
Boss-ssn
Animal
A#
Christoph F. Eick: Designing E/R Diagrams
16
gre
major
Grad Ugrad
(0,1)
advises
(0,20) Professor
gpa
ssn
name Person
Student
(0,*)
grade
(0,*)
took
(0,*)
Semester
Course
title
semesterid
Cou#
Enrolls-not-a-set: -4 Student must be ugrad or grad: -1 Other Errors: -2 (or 3 if quite major)
number company
Cred-Card
(0,*)
phone#
ssn addr
A
tr#
day_ made (0,1)
(0,300)
Client
discount
Gold_Cl. Hotel
address
G#
Transaction
(1,50) D
day
Grading: Minor Error: -1 Medium Error: -2 Major Error: -3 or 4 0-4 points if too many errors
(1,1)
Ho#
(1,*)
Reservation
(1,1) to rate Res#
Date
(1,*)
#total
from
Category
(0,*)
room-type
A:=guaranteed; B:=has_transaction; C:=for_hotel; D:=consists_of; E:=for_category; F=avail-rooms; G=total-rooms; modified on Feb. 3, 2004
name
Aggregation
Used when we have to model a relationship involving (entity sets and) a relationship set.
Aggregation allows us to treat a relationship set as an entity set for purposes of participation in (other) relationships.
ssn
Employees
lot
Monitors
until
started_on pid
Projects pbudget
since did
dname
budget
Departments
Sponsors
Aggregation vs. ternary relationship: Monitors is a distinct relationship, with a descriptive attribute. Also, can say that each sponsorship is monitored by at most one employee.
20
NFL E/R Design --Ungraded Homework --- due: Th., Jan. 27,2005
Design an Entity-Relationship Diagram that models the following objects and relationships in the world of football (NFL): teams, players, games, managers and contracts. Each (NFL-) team has a unique team name, and a city it plays in. Each person being part of the NFL-world has a unique ssn and a name. Additionally, for players their weight, height, position and birth dates are of importance. Players have a contract with at most one team and receive a salary for their services, and teams have at least 24 and at most 99 players under contract. Each team has one to three managers; managers can work for at most 4 teams and receive a salary for each of their employments. Players cannot be managers. A game involves a home-team and visitingteam; additionally, the day of the game, and the score of the game are of importance; teams play each other several times in a season (not on the same day!). Moreover, for each game played we like to know which players participated in the game and how many minutes they played. Indicate the cardinalities for each relationship type; assign roles (role names) to each relationship if there are ambiguities! Use sub-types, if helpful to express constraints!
Christoph F. Eick: Designing E/R Diagrams 21