SlideShare a Scribd company logo
ENTITY RELATIONSHIP DIAGRAM
(ERD)
Chapter 4
ICT 2073
Prepared By: Siti Hajar Ismail
OBJECTIVES
 Define terms related to entity relationship modeling,
including entity, entity instance, attribute,
relationship and cardinality, and primary key.
 Describe the entity modeling process.
 Discuss how to draw an entity relationship diagram.
 Describe how to recognize entities, attributes,
relationships, and cardinalities.
DATABASE MODEL
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
ENTITY RELATIONSHIP DIAGRAM (ERD)
 ER model allows us to sketch database designs
 ERD is a graphical tool for modeling data.
 ERD is widely used in database design
 ERD is a graphical representation of the logical structure of a
database
 ERD is a model that identifies the concepts or entities that
exist in a system and the relationships between those
entities
PURPOSES OF ERD
 better understanding of the information to be contained
in the database
 documentation tool.
 to communicate the logical structure of the database to
users
COMPONENTS OF AN ERD
An ERD typically consists of four different graphical
components:
1. Entity
2. Relationship
3. Cardinality
4. Attribute
CLASSIFICATION OF RELATIONSHIP
 Optional Relationship
 An Employee may or may not be assigned to a
Department
 A Patient may or may not be assigned to a Bed
 Mandatory Relationship
 Every Course must be taught by at least one Teacher
 Every mother have at least a Child
 For a binary relationship set the mapping cardinality must
be one of the following types:
 One to one
A Manager Head one Department and vice versa
 One to many ( or many to one)
An Employee Works in one Department or One
Department has many Employees
 Many to many
A Teacher Teaches many Students and A student is
taught by many Teachers
9
ONE-ONE AND ONE-MANY
10
MANY-ONE AND MANY-MANY
CARDINALITY CONSTRAINTS (CONTD.)
CARDINALITY CONSTRAINTS EXAMPLE
 In our model, we wish to indicate that each school may enroll
many students, or may not enroll any students at all.
 We also wish to indicate that each student attends exactly one
school. The following diagram indicates this optionality and
cardinality:
CARDINALITY CONSTRAINTS EXAMPLE
(CONTD.)
SCHOOL
STUDENT
Each school enrolls
at least zero
and at most many
students
Each student attends
at least one
and at most one
school
GENERAL STEPS TO CREATE AN ERD
 Identify the entity
 Identify the entity's attributes
 Identify the Primary Keys
 Identify the relation between entities
 Identify the Cardinality constraint
 Draw the ERD
 Check the ERD
STEPS IN BUILDING AN ERD
A SIMPLE EXAMPLE
A company has several departments. Each department has a
supervisor and at least one employee. 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.
1. IDENTIFY ENTITIES
 A company has several departments. Each department has a
supervisor and at least one employee. 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.
 A true entity should have more than one instance
2. FIND RELATIONSHIPS
 Aim is to identify the associations, the connections between pairs
of entities.
 A simple approach to do this is using a relationship matrix (table)
that has rows and columns for each of the identified entities.
FIND RELATIONSHIPS (CONTD.)
 Go through each cell and decide whether or not
there is an association. For example, the first cell
on the second row is used to indicate if there is a
relationship between the entity "Employee" and
the entity "Department".
3. IDENTIFIED RELATIONSHIPS
Names placed in the cells are meant to capture/describe
the relationships. So you can use them like this
 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
4. DRAW ROUGH ERD
Draw a diagram and:
 Place all the entities in rectangles
 Use diamonds and lines to represent the
relationships between entities.
 General Examples
DRAWING ROUGH ERD (CONTD.)
DRAWING ROUGH ERD (CONTD.)
DRAWING ROUGH ERD (CONTD.)
5. 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.
FILL IN CARDINALITY (CONTD.)
The cardinality of a relationship can only have
the following values
 One and only one
 One or more
 Zero or more
 Zero or one
CARDINALITY NOTATION
CARDINALITY EXAMPLES
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
6. ERD WITH CARDINALITY
EXAMPLES
ERD FOR COURSE ENROLLMENT
ERD FOR COURSE REGISTRATION
ROUGH ERD PLUS PRIMARY KEYS
7. IDENTIFY ATTRIBUTES
 Identify and name all the attributes essential to the system we are
studying without trying to match them to particular entities.
 The only attributes indicated are the names of the departments, projects,
supervisors and employees, as well as the supervisor and employee
NUMBER and a unique project number.
8. MAP ATTRIBUTES
 For each attribute we need to match it with exactly
one entity. Often it seems like an attribute should go
with more than one entity (e.g. Name).
MAP ATTRIBUTES (CONTD.)
DRAW FULLY ATTRIBUTED ERD
38
WEAK ENTITY SET
 Some entity sets in real world naturally depend on
some other entity set
 They can be uniquely identified only if combined with
another entity set
 Example:
 section1, section2, … become unique only if you put
them into a context, e.g. csce4350
39
WEAK ENTITY SET NOTATIONS
Double rectangles for weak entity set
Double diamond for weak entity relationship
Dashed underscore for discriminator
LEARNING OUTCOME
 Define terms related to entity relationship
modeling, including entity, entity instance, attribute,
relationship and cardinality, and primary key.
 Explain the entity modeling process.
 Draw an entity relationship diagram.

More Related Content

PPT
ER-Model-ER Diagram
PPTX
ER DIAGRAM & ER MODELING IN DBMS
PPTX
Entity Relationship Modelling
PPTX
Relational model
PDF
Create table
DOCX
Chapter 4: Enhanced Entity-Relationship and Object Modeling
PPTX
Database - Entity Relationship Diagram (ERD)
ODP
ER Model in DBMS
ER-Model-ER Diagram
ER DIAGRAM & ER MODELING IN DBMS
Entity Relationship Modelling
Relational model
Create table
Chapter 4: Enhanced Entity-Relationship and Object Modeling
Database - Entity Relationship Diagram (ERD)
ER Model in DBMS

What's hot (20)

PPTX
Data Manipulation Language
PPTX
How to Draw an Effective ER diagram
PPTX
Er diagrams presentation
PPT
Entity relationship diagram (erd)
PDF
4 the relational data model and relational database constraints
PDF
DBMS 3 | ER Diagram to Relational Schema
PPTX
SQL(DDL & DML)
PPT
2. Entity Relationship Model in DBMS
PPTX
E-R diagram in Database
PPT
1. Introduction to DBMS
PDF
Database Normalization
PPT
ER Diagram
PPT
Files Vs DataBase
PPTX
UML Diagram - Use-Case diagram, Activity Diagram, Sequence Diagram, Er Diagra...
PPT
Databases: Normalisation
PPTX
data abstraction in DBMS
PDF
Enhanced Entity-Relationship (EER) Modeling
DOCX
Chapter-3 Data Modeling Using the Entity-Relationship Model
PPT
SQL Views
PPTX
Data Modeling PPT
Data Manipulation Language
How to Draw an Effective ER diagram
Er diagrams presentation
Entity relationship diagram (erd)
4 the relational data model and relational database constraints
DBMS 3 | ER Diagram to Relational Schema
SQL(DDL & DML)
2. Entity Relationship Model in DBMS
E-R diagram in Database
1. Introduction to DBMS
Database Normalization
ER Diagram
Files Vs DataBase
UML Diagram - Use-Case diagram, Activity Diagram, Sequence Diagram, Er Diagra...
Databases: Normalisation
data abstraction in DBMS
Enhanced Entity-Relationship (EER) Modeling
Chapter-3 Data Modeling Using the Entity-Relationship Model
SQL Views
Data Modeling PPT
Ad

Viewers also liked (20)

PPTX
Entity Relationship Diagram
PPT
Erd (info sys)
PPT
Entity relationship diagram for dummies
PPT
PPT
Entity Relationship Diagrams
PPTX
Software Engineering- ERD DFD Decision Tree and Table
PPTX
Entity Relationship Diagram Templates by Creately
PPTX
Entity Relationship Diagram presentation
PPTX
Erd practice exercises
PPT
Erd examples
PDF
Professional erd models
PPTX
PDF
fashion
PPTX
Lis124
DOCX
Planning to desing the erd diagram for sms
PPTX
New energy resources
PPT
05 si(systems analysis and design )
PPTX
Entity relationship diagram
Entity Relationship Diagram
Erd (info sys)
Entity relationship diagram for dummies
Entity Relationship Diagrams
Software Engineering- ERD DFD Decision Tree and Table
Entity Relationship Diagram Templates by Creately
Entity Relationship Diagram presentation
Erd practice exercises
Erd examples
Professional erd models
fashion
Lis124
Planning to desing the erd diagram for sms
New energy resources
05 si(systems analysis and design )
Entity relationship diagram
Ad

Similar to Entity Relationship Diagram (20)

PDF
Sq lite module3
PDF
Entity relationship diagram (erd)
PPTX
A database is a means of storing information in such a way that information c...
PPTX
COMPUTER PROGRAMMING-LESSON3-ENTITY.pptx
PPTX
COMPUTER PROGRAMMING-LESSON3-ENTITY.pptx
PDF
Managment information system Managment information systemTutorial.
PPT
Er diagrams
PPT
D I T211 Chapter 3
PDF
Db lec 02_new
PPT
Week 4 The Relational Data Model & The Entity Relationship Data Model
PDF
UNIT 2 DATABASE DESIGN 9.pdf ER DIAGRAMS
PPT
ENTITY RELATION SHIPS COMPLETE ANALYSIS UPDATED
PPT
27 fcs157al3
PDF
dbms mannual.pdf
PPTX
Data Models and Relational Database Design.pptx
PDF
Unit 18
PPT
enrity relationship model and diagram .ppt
PPTX
SILVA^JMALACAD^JOMBOY REPORT.pptx
PPTX
Advance oops concepts
DOCX
Hw fdb(2)
Sq lite module3
Entity relationship diagram (erd)
A database is a means of storing information in such a way that information c...
COMPUTER PROGRAMMING-LESSON3-ENTITY.pptx
COMPUTER PROGRAMMING-LESSON3-ENTITY.pptx
Managment information system Managment information systemTutorial.
Er diagrams
D I T211 Chapter 3
Db lec 02_new
Week 4 The Relational Data Model & The Entity Relationship Data Model
UNIT 2 DATABASE DESIGN 9.pdf ER DIAGRAMS
ENTITY RELATION SHIPS COMPLETE ANALYSIS UPDATED
27 fcs157al3
dbms mannual.pdf
Data Models and Relational Database Design.pptx
Unit 18
enrity relationship model and diagram .ppt
SILVA^JMALACAD^JOMBOY REPORT.pptx
Advance oops concepts
Hw fdb(2)

Recently uploaded (20)

PDF
Mark Klimek Lecture Notes_240423 revision books _173037.pdf
PPTX
The Healthy Child – Unit II | Child Health Nursing I | B.Sc Nursing 5th Semester
PDF
Abdominal Access Techniques with Prof. Dr. R K Mishra
PPTX
Renaissance Architecture: A Journey from Faith to Humanism
PDF
grade 11-chemistry_fetena_net_5883.pdf teacher guide for all student
PPTX
Week 4 Term 3 Study Techniques revisited.pptx
PDF
Pre independence Education in Inndia.pdf
PDF
Physiotherapy_for_Respiratory_and_Cardiac_Problems WEBBER.pdf
PPTX
Introduction_to_Human_Anatomy_and_Physiology_for_B.Pharm.pptx
PDF
O5-L3 Freight Transport Ops (International) V1.pdf
PDF
Supply Chain Operations Speaking Notes -ICLT Program
PPTX
Microbial diseases, their pathogenesis and prophylaxis
PPTX
master seminar digital applications in india
PPTX
Institutional Correction lecture only . . .
PDF
The Lost Whites of Pakistan by Jahanzaib Mughal.pdf
PPTX
Cell Types and Its function , kingdom of life
PDF
Anesthesia in Laparoscopic Surgery in India
PDF
Saundersa Comprehensive Review for the NCLEX-RN Examination.pdf
PPTX
Introduction to Child Health Nursing – Unit I | Child Health Nursing I | B.Sc...
PDF
TR - Agricultural Crops Production NC III.pdf
Mark Klimek Lecture Notes_240423 revision books _173037.pdf
The Healthy Child – Unit II | Child Health Nursing I | B.Sc Nursing 5th Semester
Abdominal Access Techniques with Prof. Dr. R K Mishra
Renaissance Architecture: A Journey from Faith to Humanism
grade 11-chemistry_fetena_net_5883.pdf teacher guide for all student
Week 4 Term 3 Study Techniques revisited.pptx
Pre independence Education in Inndia.pdf
Physiotherapy_for_Respiratory_and_Cardiac_Problems WEBBER.pdf
Introduction_to_Human_Anatomy_and_Physiology_for_B.Pharm.pptx
O5-L3 Freight Transport Ops (International) V1.pdf
Supply Chain Operations Speaking Notes -ICLT Program
Microbial diseases, their pathogenesis and prophylaxis
master seminar digital applications in india
Institutional Correction lecture only . . .
The Lost Whites of Pakistan by Jahanzaib Mughal.pdf
Cell Types and Its function , kingdom of life
Anesthesia in Laparoscopic Surgery in India
Saundersa Comprehensive Review for the NCLEX-RN Examination.pdf
Introduction to Child Health Nursing – Unit I | Child Health Nursing I | B.Sc...
TR - Agricultural Crops Production NC III.pdf

Entity Relationship Diagram

  • 1. ENTITY RELATIONSHIP DIAGRAM (ERD) Chapter 4 ICT 2073 Prepared By: Siti Hajar Ismail
  • 2. OBJECTIVES  Define terms related to entity relationship modeling, including entity, entity instance, attribute, relationship and cardinality, and primary key.  Describe the entity modeling process.  Discuss how to draw an entity relationship diagram.  Describe how to recognize entities, attributes, relationships, and cardinalities.
  • 3. DATABASE MODEL 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
  • 4. ENTITY RELATIONSHIP DIAGRAM (ERD)  ER model allows us to sketch database designs  ERD is a graphical tool for modeling data.  ERD is widely used in database design  ERD is a graphical representation of the logical structure of a database  ERD is a model that identifies the concepts or entities that exist in a system and the relationships between those entities
  • 5. PURPOSES OF ERD  better understanding of the information to be contained in the database  documentation tool.  to communicate the logical structure of the database to users
  • 6. COMPONENTS OF AN ERD An ERD typically consists of four different graphical components: 1. Entity 2. Relationship 3. Cardinality 4. Attribute
  • 7. CLASSIFICATION OF RELATIONSHIP  Optional Relationship  An Employee may or may not be assigned to a Department  A Patient may or may not be assigned to a Bed  Mandatory Relationship  Every Course must be taught by at least one Teacher  Every mother have at least a Child
  • 8.  For a binary relationship set the mapping cardinality must be one of the following types:  One to one A Manager Head one Department and vice versa  One to many ( or many to one) An Employee Works in one Department or One Department has many Employees  Many to many A Teacher Teaches many Students and A student is taught by many Teachers
  • 12. CARDINALITY CONSTRAINTS EXAMPLE  In our model, we wish to indicate that each school may enroll many students, or may not enroll any students at all.  We also wish to indicate that each student attends exactly one school. The following diagram indicates this optionality and cardinality:
  • 13. CARDINALITY CONSTRAINTS EXAMPLE (CONTD.) SCHOOL STUDENT Each school enrolls at least zero and at most many students Each student attends at least one and at most one school
  • 14. GENERAL STEPS TO CREATE AN ERD  Identify the entity  Identify the entity's attributes  Identify the Primary Keys  Identify the relation between entities  Identify the Cardinality constraint  Draw the ERD  Check the ERD
  • 16. A SIMPLE EXAMPLE A company has several departments. Each department has a supervisor and at least one employee. 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.
  • 17. 1. IDENTIFY ENTITIES  A company has several departments. Each department has a supervisor and at least one employee. 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.  A true entity should have more than one instance
  • 18. 2. FIND RELATIONSHIPS  Aim is to identify the associations, the connections between pairs of entities.  A simple approach to do this is using a relationship matrix (table) that has rows and columns for each of the identified entities.
  • 19. FIND RELATIONSHIPS (CONTD.)  Go through each cell and decide whether or not there is an association. For example, the first cell on the second row is used to indicate if there is a relationship between the entity "Employee" and the entity "Department".
  • 20. 3. IDENTIFIED RELATIONSHIPS Names placed in the cells are meant to capture/describe the relationships. So you can use them like this  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
  • 21. 4. DRAW ROUGH ERD Draw a diagram and:  Place all the entities in rectangles  Use diamonds and lines to represent the relationships between entities.  General Examples
  • 22. DRAWING ROUGH ERD (CONTD.)
  • 23. DRAWING ROUGH ERD (CONTD.)
  • 24. DRAWING ROUGH ERD (CONTD.)
  • 25. 5. 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. FILL IN CARDINALITY (CONTD.) The cardinality of a relationship can only have the following values  One and only one  One or more  Zero or more  Zero or one
  • 28. CARDINALITY EXAMPLES 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
  • 29. 6. ERD WITH CARDINALITY
  • 31. ERD FOR COURSE ENROLLMENT
  • 32. ERD FOR COURSE REGISTRATION
  • 33. ROUGH ERD PLUS PRIMARY KEYS
  • 34. 7. IDENTIFY ATTRIBUTES  Identify and name all the attributes essential to the system we are studying without trying to match them to particular entities.  The only attributes indicated are the names of the departments, projects, supervisors and employees, as well as the supervisor and employee NUMBER and a unique project number.
  • 35. 8. MAP ATTRIBUTES  For each attribute we need to match it with exactly one entity. Often it seems like an attribute should go with more than one entity (e.g. Name).
  • 38. 38 WEAK ENTITY SET  Some entity sets in real world naturally depend on some other entity set  They can be uniquely identified only if combined with another entity set  Example:  section1, section2, … become unique only if you put them into a context, e.g. csce4350
  • 39. 39 WEAK ENTITY SET NOTATIONS Double rectangles for weak entity set Double diamond for weak entity relationship Dashed underscore for discriminator
  • 40. LEARNING OUTCOME  Define terms related to entity relationship modeling, including entity, entity instance, attribute, relationship and cardinality, and primary key.  Explain the entity modeling process.  Draw an entity relationship diagram.