0% found this document useful (0 votes)
21 views28 pages

Entity Relationship Model 2

The document provides a comprehensive overview of Entity Relationship Diagrams (ERDs), detailing their purpose, basic concepts, and components such as entities, attributes, and relationships. It explains various types of attributes, mapping constraints, and keys used in ER modeling, along with tips for creating effective ERDs and case studies for practical application. The ERD serves as a crucial tool for conceptual data modeling and communication between database designers and end users.

Uploaded by

soviet0607
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
21 views28 pages

Entity Relationship Model 2

The document provides a comprehensive overview of Entity Relationship Diagrams (ERDs), detailing their purpose, basic concepts, and components such as entities, attributes, and relationships. It explains various types of attributes, mapping constraints, and keys used in ER modeling, along with tips for creating effective ERDs and case studies for practical application. The ERD serves as a crucial tool for conceptual data modeling and communication between database designers and end users.

Uploaded by

soviet0607
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 28

ENTITY RELATIONSHIP ERD

MODEL
OUTLINE
Basics of ERD
Entities
Attributes
Relationships
Mapping constrains
Keys
Case studies
BASICS OF ERD

An Entity Relationship Diagram (ERD) is a visual representation of different entities


within a system and how they relate to each other in the ER model.
The main constructs of the E-R model i.e., entities, relationships and their associated
attributes.
E-R model is mainly used for:
Conceptual data modeling. Understanding the business case.
The E-R model is mainly used for communication between database designers and end
users during the analysis phase of database development.
It is popular due to the factors such as relative ease of use, CASE tool support, and the
belief that entities and relationships are natural modeling concepts in the real world.
This E-R model is a representation of the structure and constraints of a database that
is independent of the DBMS and its associated data model that will be used to
implement the database.
BASIC CONCEPTS
Enterprise
Enterprise refers to any kind of organization. Ex. Colleges, schools, banks, any company etc.
Entity
Entity refers to an “object” or “thing” in real world. Object may be any person, place, event
etc. Ex. Students of colleges and schools, loans in banks, employees in any company etc.
Attributes
These are the characteristics of any entity.
Ex., (i) A student can be described by his name, age, address, height, class etc.
(ii) Loans can be described by their types such as house loan, car loan etc.
(iii) Employees in any company can be described by their Employee ID, name, department,
designation etc.
(iv) A car can be described by his color, model, company etc
BASIC CONCEPTS
Value
Value is the information or data which is stored in attributes of any
entity.
Entity Sets
All the entities having same attributes make an entity set.
ENTITIES

Entities are real world concepts from the solution space or problem
domain.
They are represented by means of rectangles. Rectangles are named
with the entity set they represent.
An entity can be a person, place, event, or object that is relevant to a
given system. For example, a school system may include students,
teachers, major courses, subjects, fees, and other items.
A weak entity is an entity that depends on the existence of another
entity. In more technical terms it can be defined as an entity that cannot
be identified by its own attributes.
It uses a foreign key combined with its attributed to form the primary
key. An entity like order item is a good example for this.
ATTRIBUTES

An attribute is a property, trait, or characteristic of an entity,


relationship, or another attribute.
If the attributes are composite, they are further divided in a tree
like structure. Every node is then connected to its attribute.
TYPES
Simple and Composite Attributes:
Simple: Attributes are those which cannot be divided into subparts. Ex. Age of
student
Composite : Attributes are those which can be divided into subparts.
Ex. Name of a student can be divided into First Name, Middle Name, and Last Name.
Single Valued and Multi-valued Attributes
Single Valued Attribute : An attribute having only single value for a particular entity
is known as single value attribute.
Ex. Age of student.
Multi-Valued Attributes : An attribute having more than one possible value for a
particular entity is known as multi-valued attribute.
Ex. Phone number of a student. A student may have more than one phone.
TYPES
Derived Attributes and Stored Attributes:
Derived Attributes : An attribute that can be derived from other
known attributes is known as derived attribute.
Ex. Age of employees can be derived if you know date of birth and
system date.
Age = System date - Date of birth.
Stored Attributes : An attribute which cannot be derived by other
known attributes is known
as stored attribute.
Ex. Date of birth of any employee.
NULL VALUE
NULL Value : Null stands for nothing. An attribute have a null value
if either the value
of that attribute is not known or the value is not applicable.
Caution : NULL is not equal to Zero (0). But you can say that NULL
is blank as shown
in Figure 2.2.
Ex.
RELATIONSHIPS
A relationship is the association among several entities. It connects different
entities through a meaningful interaction.
A relationship describes full functionality of a database system.
For example, the entity “Carpenter” may be related to the entity “table” by the
relationship “builds” or “makes”.
Relationship Set : A relationship set is a set of relationships of the same type.
Consider an example, employees work in different departments. Then relationship
exists between employees and departments because each employee must
belongs to some department.
Relation of all employees with department when combined makes the relationship
set because each employee has same kind of relation with departments.
Relationships are represented by diamond shapes and are labeled using verbs.
RELATIONSHIP SET
DEGREE OF
RELATIONSHIP:
Total number of entity sets participate in a relationship set is known
as degree of that
relationship set.
Binary Relationship Set
A relationship set in which only two entity sets are involved is
known as binary relationship set.
Ternary Relationship Set
A relationship set in which three entity sets are involved is known
as ternary relationship set or a relationship set having degree
three.
TERNARY RELATIONSHIP SET
ROLE AND RECURSIVE
RELATIONSHIP SET
Role : The function of any entity which it plays in relationship set is
called that entity’s role. e.g., employee plays the role of worker in
his department.
Recursive Relationship Set : When the same entity sets
participate in same relationship set more than once with different
roles each time, then this type of recursive relationship set is
known as Recursive Relationship set. e.g., consider an example of
relationship set works_in and two entity set student and college.
A student who attends weekend classes in college as student may
also be lecturer in that college. Then this person plays two roles
(student, faculty) in same relationship set work_in.
MAPPING CONSTRAINTS
There are certain constraints in E-R model. Data in the database
must follow the constraints.
Constraints act as rules to which the contents of database must
conform.
There are two types of mapping constraints :
(a) Mapping cardinalities,
(b) Participation constraints.
MAPPING CARDINALITIES
(CARDINALITY RATIOS)
It specifies the number of entities of an entity set that are
associated with entities of another entity set through a relationship
set.
Mapping Cardinalities are helpful in describing binary relationship
sets.
Two entity sets X and Y having binary relationship set R must have
one of the following mapping cardinality :
1. One to One (1 : 1) : An entity in X is associated with at most
one entity in Y and
an entity in Y is associated with at most one entity in X.
e.g a country and a head of the state
MAPPING CARDINALITY
2. One to Many (1 : N) : An entity in X is associated with any
number of entities in
Y. An entity in Y is associated with at most one entity in X.
A manager has many employees under it but an employee works
under only one manager.
MAPPING CARDINALITY
3. Many to One (N : 1) : An entity in X is associated with at most
one entity in Y. An
entity in Y is associated with any number of entities in X.
A employee can work on single project while any project can be
assigned to more than one employee.
MAPPING CARDINALITY
4. Many to Many (N:N or M : N) : An entity in X is associated
with any number (zero or more) of entities in Y and vice versa.
A student can have more than one subject and one subject can be
given to more than one student.
KEYS
A key is an attribute or set of attributes that is used to identify data
in entity sets. The
attributes which are used as key are known as key attributes.
Rest of all are known as Non-key attributes.
TYPES
Super Key : A super key is a set of collection of one or more than
one attributes
that can identify data uniquely. Any entity set has more than one
super key.
(b) (ID, Name, Reg. No.)
(c) (ID)
KEYS
Primary Key : An attribute which identifies data uniquely is known
as Primary Key.
Ex. In entity set Employee, either Reg. No. is primary key or ID is
primary key.
Foreign Key : A foreign key is an attribute in any entity set which
is also a Primary Key in any other entity set.
Ex. Dept_ID: This is an attribute in entity set Employee and also a
primary key in entity set Department. Thus, it is a foreign key in
Employee.
ENTITY—RELATIONSHIP
DIAGRAM
Entity-relationship diagrams also called ERDs or ER diagrams, are
flowchart-like diagrams that explain the constructs of database of
entities, attributes, and their relationships in a database.
 Basic Elements and symbols
EXAMPLE. SINGLE ENTITY
WITH SIMPLE AND
COMPOSITE ATTRIBUTES
CROWS FOOT NOTATION
TIPS IN DRAWING AN ERD
1. Understand the problem domain. Here what you do is to get familiar with business
concepts, operations and relationship.
2. Identify the entities. The second tip in making an ERD is to identify all the entities you
will use. Take note of weak and strong entity situation. Most of weak entities are hidden from
real world.
3. Identify relationships. Look at two entities, are they related? If so draw a solid line
connecting the two entities and add a diamond between them with a brief description of
how they are related.
4. Add attributes. Any key attributes of entities should be added using oval-shaped
symbols.
5. Complete the diagram. Continue to connect the entities with lines, and adding
diamonds to describe each relationship until all relationships have been described. Each of
your entities may not have any relationships, some may have multiple relationships.
6. Repeat the process to refine the diagram.
CASE STUDIES
1. Make an E-R diagram having two entity sets, Customer and
product.
2. Make an E-R diagram having three entity set, Patient, Doctor and
Drugs.
3. Make an E-R diagram for an online store.
Practice
1. Library Management System
2. Student Management System
3. Hospital Management System

You might also like