Lecture-8 - ER Modeling
Lecture-8 - ER Modeling
ER Modeling
Types of Entities
• Strong entity
• Weak entity
Strong entity
Example
Representation
Example
• name is almost a key for football players, but
there might be two with the same name.
• number is certainly not a key, since players
on two teams could have the same number.
• But number, together with the team name
related to the player by Plays-on should be
unique.
7
In E/R Diagrams(point out mistakes )
8
In E/R Diagrams
9
Weak and strong entities
Example 2
Differences
Strong entity Weak entity
Mapping cardinalities
Mapping cardinalities
One to one
One to many
Many to one
In Pictures:
many-one
18
Many to many
In Pictures:
many-many
20
How to choose relationship
How to choose relationship
Participation constraints
Design Techniques
1. Avoid redundancy.
2. Limit the use of weak entity sets.
3. Don’t use an entity set when an attribute will
do.
24
Avoiding Redundancy
• Redundancy occurs when we say the same
thing in two or more different ways.
• Redundancy wastes space and (more
importantly) encourages inconsistency.
– The two instances of the same fact may become
inconsistent if we change one and forget to
change the other.
25
Example: Good
name name addr
26
Example: Bad
name name addr
manf
27
Example: Bad
name manf manfAddr
Cold drinks
28