Entity Relationship Diagram: BY Meer Sadaf Naeem
Entity Relationship Diagram: BY Meer Sadaf Naeem
DIAGRAM
BY
MEER SADAF NAEEM
Part-1
Understanding the
Fundamentals
BASIC CONCEPTS
WHAT IS ENTITY?
Person
WHAT IS ENTITY?
Place
WHAT IS ENTITY?
Object
WHAT IS ENTITY?
Event
ATTRIBUTES
Student
Meaningful association
among several entities.
RELATIONSHIP SET/TYPE:
Student A Mr. A
Student B Mr. B
Student C Mr. C
DEGREE OF RELATIONSHIP SET
Student A Mr. A
Student B Mr. B
Student C Mr. C
TYPES OF ATTRIBUTES
Single and composite:
1. roll number is an example of single
attribute as it can not be divided
further.
2. Name can be divided further into 3
parts consisting of first name , middle
name , last name so it is an example of
composite attribute.
TYPES OF ATTRIBUTES
Single valued and multivalued:
1.The attributes which have single
value are single valued attributes
such roll number.
2.The attributes which has a set of
values are called multivalued
attributes. Such as any student can
have more than 1 telephone
number .
TYPES OF ATTRIBUTES
Derived attribute:
• These attributes are derived from
the existing attributes of entities.
One to many
Many to one
One to one
Many to many
ONE TO MANY
A B
a1 b1
a2 b2
a3 b3
a4 b4
MANY TO ONE
A B
a1
b1
a2
a3
b2
b2
a4
b3
a5
ONE TO ONE
A B
a1 b1
a2 b2
a3 b3
a4 b4
MANY TO MANY
A B
a1 b1
a2 b2
a3
b3
a4 b4
ROLE
Student A Mr. A
Student B Mr. B
Student C Mr. C
PARTIAL PARTICIPATION
MR.A DBMS
MR.B
JAVA
MR.C
CALCULUS
MR.D
Design issues
Example : should location be an entity
or attribute?
Can a project be in more than one
location?
Does location need to be described in
more detail?
Weak entity set
Introducing to Identifiers
Identifiers
Candidate Key
• All available unique, required identifiers of an entity
Primary Key
• A unique, required identifier of an entity
• The best one of candidate keys
Foreign Key
• A reference key to another entity
• This key is the primary key of another entity
Primary Key
Natural primary key:
A natural primary key is one that exists in
the data itself.
Surrogate primary key: