0% found this document useful (0 votes)
15 views

Lecture-8 - ER Modeling

Uploaded by

madiha yousaf
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
15 views

Lecture-8 - ER Modeling

Uploaded by

madiha yousaf
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 28

Relational Databases

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 )

name number name

Players Plays- Teams


on

 Double diamond for supporting many-one relationship.


 Double rectangle for the weak entity set.

8
In E/R Diagrams

name Number name


-----------

Players Plays- Teams


on

 Double diamond for supporting many-one relationship.


 Double rectangle for the weak entity set.

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

Colddrinks ManfBy Manfs

This design gives the address of each manufacturer exactly once.

26
Example: Bad
name name addr

Coldrinks ManfBy Manfs

manf

This design states the manufacturer of a cold drinks twice: as an


attribute and as a related entity.

27
Example: Bad
name manf manfAddr

Cold drinks

This design repeats the manufacturer’s address once for each


cold drinks and loses the address if there are temporarily no
colddrinks for a manufacturer.

28

You might also like