entity relationship diagram2
DESCRIPTION
This presentation was created by me for Database subject. it described the whole process of creating ERD i.e. entity relationship diagramsTRANSCRIPT
![Page 1: Entity Relationship Diagram2](https://reader036.vdocument.in/reader036/viewer/2022062701/553ab3565503466f348b45dd/html5/thumbnails/1.jpg)
ENTITY RELATIONSHIP DIAGRAM
BY
MEER SADAF NAEEM
![Page 2: Entity Relationship Diagram2](https://reader036.vdocument.in/reader036/viewer/2022062701/553ab3565503466f348b45dd/html5/thumbnails/2.jpg)
Part-1
Understanding the Fundamentals
![Page 3: Entity Relationship Diagram2](https://reader036.vdocument.in/reader036/viewer/2022062701/553ab3565503466f348b45dd/html5/thumbnails/3.jpg)
BASIC CONCEPTS
![Page 4: Entity Relationship Diagram2](https://reader036.vdocument.in/reader036/viewer/2022062701/553ab3565503466f348b45dd/html5/thumbnails/4.jpg)
WHAT IS ENTITY?
Person
![Page 5: Entity Relationship Diagram2](https://reader036.vdocument.in/reader036/viewer/2022062701/553ab3565503466f348b45dd/html5/thumbnails/5.jpg)
WHAT IS ENTITY?
Place
![Page 6: Entity Relationship Diagram2](https://reader036.vdocument.in/reader036/viewer/2022062701/553ab3565503466f348b45dd/html5/thumbnails/6.jpg)
WHAT IS ENTITY?
Object
![Page 7: Entity Relationship Diagram2](https://reader036.vdocument.in/reader036/viewer/2022062701/553ab3565503466f348b45dd/html5/thumbnails/7.jpg)
WHAT IS ENTITY?
Event
![Page 8: Entity Relationship Diagram2](https://reader036.vdocument.in/reader036/viewer/2022062701/553ab3565503466f348b45dd/html5/thumbnails/8.jpg)
ATTRIBUTES
Student
Name Address Class Roll number Percentage
Descriptive properties possessed Descriptive properties possessed by each member of an entity set.by each member of an entity set.
![Page 9: Entity Relationship Diagram2](https://reader036.vdocument.in/reader036/viewer/2022062701/553ab3565503466f348b45dd/html5/thumbnails/9.jpg)
ENTITY SET/TYPE:
Student A Student B Student C Student D
ENTITY SET : STUDENT
Set of entities of the same type Set of entities of the same type that share the same attributes. that share the same attributes.
![Page 10: Entity Relationship Diagram2](https://reader036.vdocument.in/reader036/viewer/2022062701/553ab3565503466f348b45dd/html5/thumbnails/10.jpg)
STUDENT A STUDENT B STUDENT C STUDENT D
Mr. A Mr.DMr. CMr. B
ENTITY SET : STUDENT
ENTITY SET : TEACHER
![Page 11: Entity Relationship Diagram2](https://reader036.vdocument.in/reader036/viewer/2022062701/553ab3565503466f348b45dd/html5/thumbnails/11.jpg)
What is relationship?
Meaningful association Meaningful association among several entities.among several entities.
![Page 12: Entity Relationship Diagram2](https://reader036.vdocument.in/reader036/viewer/2022062701/553ab3565503466f348b45dd/html5/thumbnails/12.jpg)
RELATIONSHIP SET/TYPE:
A set of relationships of the A set of relationships of the same type.same type.
![Page 13: Entity Relationship Diagram2](https://reader036.vdocument.in/reader036/viewer/2022062701/553ab3565503466f348b45dd/html5/thumbnails/13.jpg)
Student A
Student C
Student B
Mr. C
Mr. B
Mr. A
ENTITY SET : STUDENT ENTITY SET : TEACHER
RELATIONSHIP SET : SUBJECT
![Page 14: Entity Relationship Diagram2](https://reader036.vdocument.in/reader036/viewer/2022062701/553ab3565503466f348b45dd/html5/thumbnails/14.jpg)
DEGREE OF RELATIONSHIP SET
The number of entity sets that The number of entity sets that participate in a relationship participate in a relationship set.set.
![Page 15: Entity Relationship Diagram2](https://reader036.vdocument.in/reader036/viewer/2022062701/553ab3565503466f348b45dd/html5/thumbnails/15.jpg)
Student A
Student C
Student B
Mr. C
Mr. B
Mr. A
ENTITY SET : STUDENT ENTITY SET : TEACHER
RELATIONSHIP SET : SUBJECT
![Page 16: Entity Relationship Diagram2](https://reader036.vdocument.in/reader036/viewer/2022062701/553ab3565503466f348b45dd/html5/thumbnails/16.jpg)
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.
![Page 17: Entity Relationship Diagram2](https://reader036.vdocument.in/reader036/viewer/2022062701/553ab3565503466f348b45dd/html5/thumbnails/17.jpg)
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 .
![Page 18: Entity Relationship Diagram2](https://reader036.vdocument.in/reader036/viewer/2022062701/553ab3565503466f348b45dd/html5/thumbnails/18.jpg)
TYPES OF ATTRIBUTES
Derived attribute:
•These attributes are derived from the existing attributes of entities.
•The value of a derived attribute is not stored , but computed when required.
![Page 19: Entity Relationship Diagram2](https://reader036.vdocument.in/reader036/viewer/2022062701/553ab3565503466f348b45dd/html5/thumbnails/19.jpg)
Student
Name Address Class Roll number Date-of-birth
![Page 20: Entity Relationship Diagram2](https://reader036.vdocument.in/reader036/viewer/2022062701/553ab3565503466f348b45dd/html5/thumbnails/20.jpg)
TYPES OF ATTRIBUTES
Descriptive attribute:
•The attribute of the relationship is called descriptive attribute.
![Page 21: Entity Relationship Diagram2](https://reader036.vdocument.in/reader036/viewer/2022062701/553ab3565503466f348b45dd/html5/thumbnails/21.jpg)
Cardinality
One to manyMany to oneOne to oneMany to many
It expresses the number of entities to which It expresses the number of entities to which another entity can be associated via a another entity can be associated via a relationship set.relationship set.
![Page 22: Entity Relationship Diagram2](https://reader036.vdocument.in/reader036/viewer/2022062701/553ab3565503466f348b45dd/html5/thumbnails/22.jpg)
ONE TO MANY
A B
a1
a4
a2
a3
b4
b3
b2
b1
![Page 23: Entity Relationship Diagram2](https://reader036.vdocument.in/reader036/viewer/2022062701/553ab3565503466f348b45dd/html5/thumbnails/23.jpg)
MANY TO ONE
b2
a1
a2
a5b3
b2
b1
a3
a4
A B
![Page 24: Entity Relationship Diagram2](https://reader036.vdocument.in/reader036/viewer/2022062701/553ab3565503466f348b45dd/html5/thumbnails/24.jpg)
ONE TO ONE
a1
a2
a3
a4 b4
b3
b2
b1
A B
![Page 25: Entity Relationship Diagram2](https://reader036.vdocument.in/reader036/viewer/2022062701/553ab3565503466f348b45dd/html5/thumbnails/25.jpg)
MANY TO MANY
a1
a3
a2
b4
b3
b2
b1
a4
A B
![Page 26: Entity Relationship Diagram2](https://reader036.vdocument.in/reader036/viewer/2022062701/553ab3565503466f348b45dd/html5/thumbnails/26.jpg)
ROLE
Not specified when entity sets that participate in a relationship set are distinct.
Clarification is needed only when the entity sets of a relationship set are not distinct.
The function that an entity plays in a relationship is called that entity’s role.
![Page 27: Entity Relationship Diagram2](https://reader036.vdocument.in/reader036/viewer/2022062701/553ab3565503466f348b45dd/html5/thumbnails/27.jpg)
RECURSIVE RELATIONSHIP
When entities are self-linked then When entities are self-linked then such a relationship is called a such a relationship is called a recursive relationship.recursive relationship.
![Page 28: Entity Relationship Diagram2](https://reader036.vdocument.in/reader036/viewer/2022062701/553ab3565503466f348b45dd/html5/thumbnails/28.jpg)
TOTAL PARTICIPATION
The participation of an entity set E in a The participation of an entity set E in a relationship set R is said to be TOTAL if relationship set R is said to be TOTAL if every entity in E participates in at least one every entity in E participates in at least one relationship in R.relationship in R.
![Page 29: Entity Relationship Diagram2](https://reader036.vdocument.in/reader036/viewer/2022062701/553ab3565503466f348b45dd/html5/thumbnails/29.jpg)
Student A
Student C
Student B
Mr. C
Mr. B
Mr. A
ENTITY SET : STUDENT ENTITY SET : TEACHER
RELATIONSHIP SET : SUBJECT
![Page 30: Entity Relationship Diagram2](https://reader036.vdocument.in/reader036/viewer/2022062701/553ab3565503466f348b45dd/html5/thumbnails/30.jpg)
PARTIAL PARTICIPATION
The participation an entity set E in a The participation an entity set E in a relationship set R is said to be PARTIAL if relationship set R is said to be PARTIAL if only some entities in E participate in only some entities in E participate in relationships in R.relationships in R.
![Page 31: Entity Relationship Diagram2](https://reader036.vdocument.in/reader036/viewer/2022062701/553ab3565503466f348b45dd/html5/thumbnails/31.jpg)
MR.A
MR.C
MR.D
MR.B
CALCULUS
JAVA
DBMS
FACULTY COURSESRELATIONSHIP SET:COURSE
![Page 32: Entity Relationship Diagram2](https://reader036.vdocument.in/reader036/viewer/2022062701/553ab3565503466f348b45dd/html5/thumbnails/32.jpg)
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?
![Page 33: Entity Relationship Diagram2](https://reader036.vdocument.in/reader036/viewer/2022062701/553ab3565503466f348b45dd/html5/thumbnails/33.jpg)
Weak entity set
Existence of weak entity set depends on the existence of a strong entity set which is called the identifying entity set.
The relationship is always many-to-one from weak to identifying.
Participation of the weak entity set in the relationship must be total.
An entity set that does not have sufficient attributes to An entity set that does not have sufficient attributes to form a primary key is referred to as a weak entity set.form a primary key is referred to as a weak entity set.
![Page 34: Entity Relationship Diagram2](https://reader036.vdocument.in/reader036/viewer/2022062701/553ab3565503466f348b45dd/html5/thumbnails/34.jpg)
Part-2
Introducing to Identifiers
![Page 35: Entity Relationship Diagram2](https://reader036.vdocument.in/reader036/viewer/2022062701/553ab3565503466f348b45dd/html5/thumbnails/35.jpg)
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
![Page 36: Entity Relationship Diagram2](https://reader036.vdocument.in/reader036/viewer/2022062701/553ab3565503466f348b45dd/html5/thumbnails/36.jpg)
Primary Key
Natural primary key:A natural primary key is one that exists in
the data itself. Surrogate primary key:
The primary key that you have created where non existed before.
Primary key requires the consideration not just of the current data, but of possible future data as well.
![Page 37: Entity Relationship Diagram2](https://reader036.vdocument.in/reader036/viewer/2022062701/553ab3565503466f348b45dd/html5/thumbnails/37.jpg)
Why is it important to identify primary key?
The primary key is the main “Handle” that the database server uses to grab the information in which you are interested.
By identifying a primary key, you are telling the server which information you want to work with at the moment.
![Page 38: Entity Relationship Diagram2](https://reader036.vdocument.in/reader036/viewer/2022062701/553ab3565503466f348b45dd/html5/thumbnails/38.jpg)
Foreign Key
A primary key of one table that is included in another table.
Links the records in one database table to another table.
![Page 39: Entity Relationship Diagram2](https://reader036.vdocument.in/reader036/viewer/2022062701/553ab3565503466f348b45dd/html5/thumbnails/39.jpg)