Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 24

09/11/2020 Badakhshan University Faculty of Computer 1

Science
Islamic Republic of Afghanistan
Ministry of Higher Education
Badakhshan University
Computer Science Faculty

Database Fundamentals

09/11/2020 Badakhshan University Faculty of Computer 2


Science
Lecture #5

Entity Relationship (E-R) Model

09/11/2020 Badakhshan University Faculty of Computer 3


Science
Entity Relationship (E-R) Model

An entity relationship (E-R) model is a detailed, logical representation


of the data for an organization or for a business area.
The entity relationship (E-R) model consist of entities, the relationships
among those entities and the attributes of both the entities and
relationship.
An entity relationship (E-R) model is also called Entity relationship
diagram or E-R diagrams which is graphical representation of and
Entitles , Attributes and Relationship.

09/11/2020 Badakhshan University Faculty of Computer 4


Science
Advantages of E-R Model

Conceptual Simplicity: E-R Model represents the Concept of


Database along with its Entities and Relationship in an easy way.
Visual Representation: E-R Model Provides a visual representation of
data and data among data.
Effective Communication Tools: E-R Model works as an effective
Communication tool to integrate the views.
Integrated with Relation Database Model: The integration of E-R
Model makes relational database design a very structured process.

09/11/2020 Badakhshan University Faculty of Computer 5


Science
Elements of E-R Model
Entity relationship model or ( E-R Model) involve different types of
elements such us:
1. Entity
2. Attribute
3. Relationship

09/11/2020 Badakhshan University Faculty of Computer 6


Science
1. Entity :
An entity is a person, place, object, or event in the user environment
about which the organization want to maintain data.
For example the hospital system may include entity like patient , doctor
etc.
Some example of entity
Person : Employ, Student, Doctor, Patient
Place : Store, Country, Province
Object : Machine, Building, Furniture
Event : Purchase, Sale, Registration
Concept : ACCOUNT , PROGRAMMING
Note: Person is an entity type and Employee ,Student are the Entities.

09/11/2020 Badakhshan University Faculty of Computer 7


Science
1.Entity Type :

An entity type is a collection of entities with same or common


properties or characteristic.
Each entity type in E-R model is given a name, because the name
represent a collection of items.
Entity type is always singular, and use capital letters for names of entity
types
In an E-R diagram the entity name is placed inside the box which
representing the entity type

09/11/2020 Badakhshan University Faculty of Computer 8


Science
2. Entity Instance:
An entity instance is a single member or occurrence of entity type is
called entity instance
Each entity instance of an entity type has its own value for each
instance
For example we have the Employ entity type in this employ entity type
the Ahmad is the entity instance of that Employ entity type

09/11/2020 Badakhshan University Faculty of Computer 9


Science
Types of Entity
1. Weak Entity :
Weak entity is a type of entity whose existence depends of some other
entity. Means it can exist only if another entity exist
A weak entity has no meaning in E-R diagram without the entity on
which it depends.
It is also called child, dependent or subordinate entity
In the E-R diagram we represent the weak entity as double – line
square

09/11/2020 Badakhshan University Faculty of Computer 10


Science
Example of weak Entity

09/11/2020 Badakhshan University Faculty of Computer 11


Science
2. Strong Entity :
Strong entity is a type of entity whose existence does not depends of
some other entity. Means it can exist without the existence of another
entity
Strong entity is also called parent, owner or dominant entity
In the E-R diagram we represent the Strong entity as single– line
square

09/11/2020 Badakhshan University Faculty of Computer 12


Science
Example of Strong Entity

In the above example PERSON is a strong entity, which its existence is


does not depend on the existence of another entity

09/11/2020 Badakhshan University Faculty of Computer 13


Science
2.Attributes :
An attribute is a property or characteristic of an entity type that is
interest to the organization
In the naming attribute, we use an initial capital letter followed by lower
case letters
If an attribute name consist of two words, we use an underscore
character to connect the words with each other
For example we have the STUDENT entity type some attributes are :
Student_ID , Name , Phone_Number , Home_Address etc.

09/11/2020 Badakhshan University Faculty of Computer 14


Science
Example of Attribute

09/11/2020 Badakhshan University Faculty of Computer 15


Science
Types of Attribute
1.Simple /Atomic Attribute :
Simple attribute is an attribute that cannot be subdivided into smaller
component
Simple attribute is also called atomic attribute
For example a student can have only one date of birth and gender
Birth_Date Gender

STUDENT

09/11/2020 Badakhshan University Faculty of Computer 16


Science
Types of Attribute….
2. Composite Attribute :
Composite Attribute is a type of attribute that can be divided into
smaller component
For example the Address is an example of composite attribute

09/11/2020 Badakhshan University Faculty of Computer 17


Science
Types of Attribute….
Employee
Name

First Namet

Last Name

Middle Name
Nickname

09/11/2020 Badakhshan University Faculty of Computer 18


Science
Types of Attributes…..
3. Single Value Attribute :
It is a type of attribute that may contain single value is called single
value attribute
4. Multi Value Attribute :
It is a type of attribute that may contain two or more than two value is
called multi value attributes
Multi value attribute is represented as double line oval
For example : An employ can have two or more than two university
degree, an also its possible in an organization an employ may have
many skills

09/11/2020 Badakhshan University Faculty of Computer 19


Science
Types of Attributes…….
5. Derived attributes :
Derived Attribute is a type of attribute that is not stored in the
database, but derived from another value
The value of derived attribute can be calculated from another related
attribute values.
Derived attribute is represented in E-R diagram in ellipse with a dashed
line

09/11/2020 Badakhshan University Faculty of Computer 20


Science
Types of Attributes…….
6. Stored Attribute:
A type of attribute that can not be derived from other attributes are
called as stored attribute.
Example : the birth Date of an employee is a stored attribute
7. Complex attributes:
A type of attributes which is made using multi valued attributes and
composite attributes then it is known as complex attributes.
Example : a person can have more than one residence each residence
can have more than one phone.

09/11/2020 Badakhshan University Faculty of Computer 21


Science
Types of Attributes…….
8.Key Attributes:
This attributes represent the main characteristic of an entity primary
key.
The key attribute has clearly different value for each element in an
entity set.
Example : Student ID , Serial No , Identity car No Student_ID

9.Non Key attributes: The attributes that do not represent the main
characteristic of an entity.
Example : Name , f/name, address …..

09/11/2020 Badakhshan University Faculty of Computer 22


Science
Types of Attributes…….
10. Required Attributes:
A type of attribute that must have a data, because they describe the
vital part of the entity.
Example : for a STUDENT entity the Student Name is the vital part of
the student entity.
11. Optional/Null value Attributes:
This type of attribute does not have a value and can be left blank, its
optional can be filled or cannot be.
Example: for a STUDENT entity the middle name or email address is
an optional attribute. It can be filled or not.

09/11/2020 Badakhshan University Faculty of Computer 23


Science
Any Questions & Suggestions

Email: mqm.dacaar@gmail.com
Phone: +0789152242

09/11/2020 Badakhshan University Faculty of Computer 24


Science

You might also like