Entity Relationship Diagram (ERD)
Presented by,
RAKHI MUKHERJI
BSc. Part-3 (Computer Hons.)
12181SC102
OBJECTIVES
 To understand What is an ERD & why it is used?
 Define terms related to entity relationship modeling,
including entity, relationship ,cardinality, attributes
,primary key.
 Describe the steps involved in entity relationship
diagram.
 Describe how to recognize entities, attributes,
relationships, and cardinalities.
 Discuss how to draw an entity relationship diagram with
the help of an example.
*
A database can be modeled as:
*a collection of entities,
*relationship among entities.
Database systems are often modeled using an
Entity Relationship (ER) diagram as the
"blueprint" from which the actual data is stored —
the output of the design phase.
The ERD is used to communicate the logical
structure of the database to users
ERD is a model that identifies the
entities that exist in a system and the
relationships between those entities
ERD is a graphical tool for modeling
data.
ER model allows us to sketch
database designs
Components of an ERD
An ERD
consists of
four
components
Entity
Relationship
Cardinality
Attributes
BASIC CONCEPTS
WHAT IS ENTITY?
• Person, place, object, event or concept about
which data is to be maintained
• Examples of entities:
– Person: EMPLOYEE, STUDENT, PATIENT
– Place: STORE, WAREHOUSE
– Object: MACHINE, PRODUCT, CAR
– Event: SALE,REGISTRATION, RENEWAL
– Concept: ACCOUNT, COURSE
WHAT IS ENTITY?
• Person
WHAT IS ENTITY?
• Place
WHAT IS ENTITY?
• Object
WHAT IS ENTITY?
• Event
 Associations between instances of one or more entity types that is of
interest
Meaningful association among several entities.
 Given a name that describes its function.
Author Book
Writes
 Unary Relationship: between two instances of
one entity type.
Student
Cheats
from
Binary Relationship : between the instances of
two entity types.
Teacher Teaches Subject
 Ternary Relationship : among the instances of
three entity types
A
A
A
A
B
B
B
B
Each instance of A is related to a minimum of
zero and a maximum of one instance of B
Each instance of B is related to a minimum of
one and a maximum of one instance of A
Each instance of A is related to a minimum of
one and a maximum of many instances of B
Each instance of B is related to a minimum of
zero and a maximum of many instances of A
• Cardinality : minimum and maximum number of
instances of Entity B that can (or must be)
associated with each instance of entity A.
CARDINALITY EXAMPLE
SCHOOL
STUDENT
Each school enrolls
at least zero
and at most many
students
Each student attends
at least one
and at most one
school
ATTRIBUTES
Descriptive properties possessed by
each member of an entity set.
Example of entity types and
associated attributes:
Student: Student_name
Employee: Employee_age
Event: Event_location
Student
Name Gender Class
Roll
number
Age
Primary Key: An attribute that has
been selected as the unique identifying
characteristic for an entity type.
Example:
Student: Student_rollnumber
Staff: Staff_Id
General Steps to create an ERD
Identify
the
entity
Identify
the
relation
between
entities
Identify
the
Cardinality
constraint
Identify
the
entity's
attributes
Draw the
ERD
A Simple Example
A company has several departments. Each
department has a supervisor and at least one
employee. Every supervisor has only one
department under him. Employees must be
assigned to at least one, but possibly more
departments. At least one employee is assigned to
a project, but an employee may be on vacation
and not assigned to any projects. The important
data fields are the names of the departments,
projects, supervisors and employees, as well as the
supervisor and employee number and a unique
project number.
• A company has several departments. Each department has
a supervisor and at least one employee. Every supervisor
has only one department under him Employees must be
assigned to at least one, but possibly more departments. At
least one employee is assigned to a project, but an
employee may be on vacation and not assigned to any
projects. The important data fields are the names of the
departments, projects, supervisors and employees, as well
as the supervisor and employee number and a unique
project number.
• A true entity should have more than one instance
A Department is assigned an employee
A Department is run by a supervisor
An employee belongs to a department
An employee works on a project
A supervisor runs a department
A project uses an employee
Fill in Cardinality
• Supervisor
– Each department has one supervisor.
• Department
– Each supervisor has one department.
– Each employee can belong to one or more departments
• Employee
– Each department must have one or more employees
– Each project must have one or more employees
• Project
– Each employee can have 0 or more projects.
ERD with Cardinality
Employee
Supervisor
Project
• Employee Name
• Employee No.
• Supervisor Name
• Supervisor No.
• Project Name
• Project No.
Department Department
Name
ATTRIBUTES
Rough ERD Plus Primary Keys
Fully Attributed ERD
Department
Is Assign
Supervisor
Employee ProjectWorks
On
Runs
By
Department
Name
Project
Name
Project
Number
Employee
Number
Supervisor
Number
Supervisor
Name
Employee
Name
Entity Relationship Diagram

Entity Relationship Diagram

  • 1.
    Entity Relationship Diagram(ERD) Presented by, RAKHI MUKHERJI BSc. Part-3 (Computer Hons.) 12181SC102
  • 2.
    OBJECTIVES  To understandWhat is an ERD & why it is used?  Define terms related to entity relationship modeling, including entity, relationship ,cardinality, attributes ,primary key.  Describe the steps involved in entity relationship diagram.  Describe how to recognize entities, attributes, relationships, and cardinalities.  Discuss how to draw an entity relationship diagram with the help of an example.
  • 3.
    * A database canbe modeled as: *a collection of entities, *relationship among entities. Database systems are often modeled using an Entity Relationship (ER) diagram as the "blueprint" from which the actual data is stored — the output of the design phase. The ERD is used to communicate the logical structure of the database to users
  • 4.
    ERD is amodel that identifies the entities that exist in a system and the relationships between those entities ERD is a graphical tool for modeling data. ER model allows us to sketch database designs
  • 5.
    Components of anERD An ERD consists of four components Entity Relationship Cardinality Attributes
  • 6.
  • 7.
    WHAT IS ENTITY? •Person, place, object, event or concept about which data is to be maintained • Examples of entities: – Person: EMPLOYEE, STUDENT, PATIENT – Place: STORE, WAREHOUSE – Object: MACHINE, PRODUCT, CAR – Event: SALE,REGISTRATION, RENEWAL – Concept: ACCOUNT, COURSE
  • 8.
  • 9.
  • 10.
  • 11.
  • 12.
     Associations betweeninstances of one or more entity types that is of interest Meaningful association among several entities.  Given a name that describes its function. Author Book Writes
  • 13.
     Unary Relationship:between two instances of one entity type. Student Cheats from
  • 14.
    Binary Relationship :between the instances of two entity types. Teacher Teaches Subject
  • 15.
     Ternary Relationship: among the instances of three entity types
  • 16.
    A A A A B B B B Each instance ofA is related to a minimum of zero and a maximum of one instance of B Each instance of B is related to a minimum of one and a maximum of one instance of A Each instance of A is related to a minimum of one and a maximum of many instances of B Each instance of B is related to a minimum of zero and a maximum of many instances of A • Cardinality : minimum and maximum number of instances of Entity B that can (or must be) associated with each instance of entity A.
  • 17.
    CARDINALITY EXAMPLE SCHOOL STUDENT Each schoolenrolls at least zero and at most many students Each student attends at least one and at most one school
  • 18.
    ATTRIBUTES Descriptive properties possessedby each member of an entity set. Example of entity types and associated attributes: Student: Student_name Employee: Employee_age Event: Event_location
  • 19.
    Student Name Gender Class Roll number Age PrimaryKey: An attribute that has been selected as the unique identifying characteristic for an entity type. Example: Student: Student_rollnumber Staff: Staff_Id
  • 20.
    General Steps tocreate an ERD Identify the entity Identify the relation between entities Identify the Cardinality constraint Identify the entity's attributes Draw the ERD
  • 21.
    A Simple Example Acompany has several departments. Each department has a supervisor and at least one employee. Every supervisor has only one department under him. Employees must be assigned to at least one, but possibly more departments. At least one employee is assigned to a project, but an employee may be on vacation and not assigned to any projects. The important data fields are the names of the departments, projects, supervisors and employees, as well as the supervisor and employee number and a unique project number.
  • 22.
    • A companyhas several departments. Each department has a supervisor and at least one employee. Every supervisor has only one department under him Employees must be assigned to at least one, but possibly more departments. At least one employee is assigned to a project, but an employee may be on vacation and not assigned to any projects. The important data fields are the names of the departments, projects, supervisors and employees, as well as the supervisor and employee number and a unique project number. • A true entity should have more than one instance
  • 23.
    A Department isassigned an employee A Department is run by a supervisor An employee belongs to a department An employee works on a project A supervisor runs a department A project uses an employee
  • 25.
    Fill in Cardinality •Supervisor – Each department has one supervisor. • Department – Each supervisor has one department. – Each employee can belong to one or more departments • Employee – Each department must have one or more employees – Each project must have one or more employees • Project – Each employee can have 0 or more projects.
  • 26.
  • 27.
    Employee Supervisor Project • Employee Name •Employee No. • Supervisor Name • Supervisor No. • Project Name • Project No. Department Department Name ATTRIBUTES
  • 28.
    Rough ERD PlusPrimary Keys
  • 29.
    Fully Attributed ERD Department IsAssign Supervisor Employee ProjectWorks On Runs By Department Name Project Name Project Number Employee Number Supervisor Number Supervisor Name Employee Name