SlideShare a Scribd company logo
1 of 40
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

What's hot

The entity relationship model
The entity relationship modelThe entity relationship model
The entity relationship modelyash patel
 
Database Systems - Entity Relationship Modeling (Chapter 4/2)
Database Systems - Entity Relationship Modeling (Chapter 4/2)Database Systems - Entity Relationship Modeling (Chapter 4/2)
Database Systems - Entity Relationship Modeling (Chapter 4/2)Vidyasagar Mundroy
 
2. Entity Relationship Model in DBMS
2. Entity Relationship Model in DBMS2. Entity Relationship Model in DBMS
2. Entity Relationship Model in DBMSkoolkampus
 
Database Design Slide 1
Database Design Slide 1Database Design Slide 1
Database Design Slide 1ahfiki
 
data modeling and models
data modeling and modelsdata modeling and models
data modeling and modelssabah N
 
Entity Relationship Modelling
Entity Relationship ModellingEntity Relationship Modelling
Entity Relationship ModellingBhandari Nawaraj
 
Fundamentals of database system - Relational data model and relational datab...
Fundamentals of database system  - Relational data model and relational datab...Fundamentals of database system  - Relational data model and relational datab...
Fundamentals of database system - Relational data model and relational datab...Mustafa Kamel Mohammadi
 
Type of database models
Type of database modelsType of database models
Type of database modelsSanthiNivas
 
Desigining of Database - ER Model
Desigining of Database - ER ModelDesigining of Database - ER Model
Desigining of Database - ER ModelAjay Chhimpa
 
Enhanced Entity-Relationship (EER) Modeling
Enhanced Entity-Relationship (EER) ModelingEnhanced Entity-Relationship (EER) Modeling
Enhanced Entity-Relationship (EER) Modelingsontumax
 
Data modeling using the entity relationship model
Data modeling using the entity relationship modelData modeling using the entity relationship model
Data modeling using the entity relationship modelJafar Nesargi
 
How to Draw an Effective ER diagram
How to Draw an Effective ER diagramHow to Draw an Effective ER diagram
How to Draw an Effective ER diagramTech_MX
 

What's hot (20)

Entity relationship modelling
Entity relationship modellingEntity relationship modelling
Entity relationship modelling
 
Er diagrams presentation
Er diagrams presentationEr diagrams presentation
Er diagrams presentation
 
Ch 3 E R Model
Ch 3  E R  ModelCh 3  E R  Model
Ch 3 E R Model
 
The entity relationship model
The entity relationship modelThe entity relationship model
The entity relationship model
 
Database Systems - Entity Relationship Modeling (Chapter 4/2)
Database Systems - Entity Relationship Modeling (Chapter 4/2)Database Systems - Entity Relationship Modeling (Chapter 4/2)
Database Systems - Entity Relationship Modeling (Chapter 4/2)
 
SQL - RDBMS Concepts
SQL - RDBMS ConceptsSQL - RDBMS Concepts
SQL - RDBMS Concepts
 
Chapter 4 Structured Query Language
Chapter 4 Structured Query LanguageChapter 4 Structured Query Language
Chapter 4 Structured Query Language
 
2. Entity Relationship Model in DBMS
2. Entity Relationship Model in DBMS2. Entity Relationship Model in DBMS
2. Entity Relationship Model in DBMS
 
Database Design Slide 1
Database Design Slide 1Database Design Slide 1
Database Design Slide 1
 
data modeling and models
data modeling and modelsdata modeling and models
data modeling and models
 
Er model
Er modelEr model
Er model
 
Modelo E-R.pdf
Modelo E-R.pdfModelo E-R.pdf
Modelo E-R.pdf
 
Entity Relationship Modelling
Entity Relationship ModellingEntity Relationship Modelling
Entity Relationship Modelling
 
Fundamentals of database system - Relational data model and relational datab...
Fundamentals of database system  - Relational data model and relational datab...Fundamentals of database system  - Relational data model and relational datab...
Fundamentals of database system - Relational data model and relational datab...
 
Entity relation(1)
Entity relation(1)Entity relation(1)
Entity relation(1)
 
Type of database models
Type of database modelsType of database models
Type of database models
 
Desigining of Database - ER Model
Desigining of Database - ER ModelDesigining of Database - ER Model
Desigining of Database - ER Model
 
Enhanced Entity-Relationship (EER) Modeling
Enhanced Entity-Relationship (EER) ModelingEnhanced Entity-Relationship (EER) Modeling
Enhanced Entity-Relationship (EER) Modeling
 
Data modeling using the entity relationship model
Data modeling using the entity relationship modelData modeling using the entity relationship model
Data modeling using the entity relationship model
 
How to Draw an Effective ER diagram
How to Draw an Effective ER diagramHow to Draw an Effective ER diagram
How to Draw an Effective ER diagram
 

Viewers also liked

Viewers also liked (20)

Erd
ErdErd
Erd
 
Erd (info sys)
Erd (info sys)Erd (info sys)
Erd (info sys)
 
Entity relationship diagram for dummies
Entity relationship diagram for dummiesEntity relationship diagram for dummies
Entity relationship diagram for dummies
 
ERD Example
ERD ExampleERD Example
ERD Example
 
Entity Relationship Diagrams
Entity Relationship DiagramsEntity Relationship Diagrams
Entity Relationship Diagrams
 
Software Engineering- ERD DFD Decision Tree and Table
Software Engineering- ERD DFD Decision Tree and TableSoftware Engineering- ERD DFD Decision Tree and Table
Software Engineering- ERD DFD Decision Tree and Table
 
Entity Relationship Diagram Templates by Creately
Entity Relationship Diagram Templates by CreatelyEntity Relationship Diagram Templates by Creately
Entity Relationship Diagram Templates by Creately
 
Entity Relationship Diagram presentation
Entity Relationship Diagram presentationEntity Relationship Diagram presentation
Entity Relationship Diagram presentation
 
Erd practice exercises
Erd practice exercisesErd practice exercises
Erd practice exercises
 
Erd examples
Erd examplesErd examples
Erd examples
 
Erd1
Erd1Erd1
Erd1
 
Professional erd models
Professional erd modelsProfessional erd models
Professional erd models
 
123
123123
123
 
fashion
fashionfashion
fashion
 
Lis124
Lis124Lis124
Lis124
 
Planning to desing the erd diagram for sms
Planning to desing the erd diagram  for smsPlanning to desing the erd diagram  for sms
Planning to desing the erd diagram for sms
 
New energy resources
New energy resourcesNew energy resources
New energy resources
 
05 si(systems analysis and design )
05 si(systems analysis and design )05 si(systems analysis and design )
05 si(systems analysis and design )
 
Entity relationship diagram
Entity relationship diagramEntity relationship diagram
Entity relationship diagram
 
Major Project
Major ProjectMajor Project
Major Project
 

Similar to Entity Relationship Diagram

Entity relationship diagram (erd)
Entity relationship  diagram (erd)Entity relationship  diagram (erd)
Entity relationship diagram (erd)Shahariar Alam
 
Managment information system Managment information systemTutorial.
Managment information system Managment information systemTutorial.Managment information system Managment information systemTutorial.
Managment information system Managment information systemTutorial.SrishtiKumar8
 
D I T211 Chapter 3
D I T211    Chapter 3D I T211    Chapter 3
D I T211 Chapter 3askme
 
Week 4 The Relational Data Model & The Entity Relationship Data Model
Week 4 The Relational Data Model & The Entity Relationship Data ModelWeek 4 The Relational Data Model & The Entity Relationship Data Model
Week 4 The Relational Data Model & The Entity Relationship Data Modeloudesign
 
SILVA^JMALACAD^JOMBOY REPORT.pptx
SILVA^JMALACAD^JOMBOY REPORT.pptxSILVA^JMALACAD^JOMBOY REPORT.pptx
SILVA^JMALACAD^JOMBOY REPORT.pptxAngelaicaOmboy
 
U2_ER_modeling.pptx
U2_ER_modeling.pptxU2_ER_modeling.pptx
U2_ER_modeling.pptxssusera7b660
 
Fundamentals of database system - Data Modeling Using the Entity-Relationshi...
Fundamentals of database system  - Data Modeling Using the Entity-Relationshi...Fundamentals of database system  - Data Modeling Using the Entity-Relationshi...
Fundamentals of database system - Data Modeling Using the Entity-Relationshi...Mustafa Kamel Mohammadi
 
introduction of database in DBMS
introduction of database in DBMSintroduction of database in DBMS
introduction of database in DBMSAbhishekRajpoot8
 
Entity relationship diagram (erd)
Entity relationship diagram (erd)Entity relationship diagram (erd)
Entity relationship diagram (erd)tameemyousaf
 

Similar to Entity Relationship Diagram (20)

Sq lite module3
Sq lite module3Sq lite module3
Sq lite module3
 
Entity relationship diagram (erd)
Entity relationship  diagram (erd)Entity relationship  diagram (erd)
Entity relationship diagram (erd)
 
Managment information system Managment information systemTutorial.
Managment information system Managment information systemTutorial.Managment information system Managment information systemTutorial.
Managment information system Managment information systemTutorial.
 
Er diagrams
Er diagramsEr diagrams
Er diagrams
 
D I T211 Chapter 3
D I T211    Chapter 3D I T211    Chapter 3
D I T211 Chapter 3
 
Db lec 02_new
Db lec 02_newDb lec 02_new
Db lec 02_new
 
Week 4 The Relational Data Model & The Entity Relationship Data Model
Week 4 The Relational Data Model & The Entity Relationship Data ModelWeek 4 The Relational Data Model & The Entity Relationship Data Model
Week 4 The Relational Data Model & The Entity Relationship Data Model
 
27 fcs157al3
27 fcs157al327 fcs157al3
27 fcs157al3
 
dbms mannual.pdf
dbms mannual.pdfdbms mannual.pdf
dbms mannual.pdf
 
Unit 18
Unit 18Unit 18
Unit 18
 
SILVA^JMALACAD^JOMBOY REPORT.pptx
SILVA^JMALACAD^JOMBOY REPORT.pptxSILVA^JMALACAD^JOMBOY REPORT.pptx
SILVA^JMALACAD^JOMBOY REPORT.pptx
 
Advance oops concepts
Advance oops conceptsAdvance oops concepts
Advance oops concepts
 
Hw fdb(2)
Hw fdb(2)Hw fdb(2)
Hw fdb(2)
 
Hw fdb(2)
Hw fdb(2)Hw fdb(2)
Hw fdb(2)
 
U2_ER_modeling.pptx
U2_ER_modeling.pptxU2_ER_modeling.pptx
U2_ER_modeling.pptx
 
Sq lite module4
Sq lite module4Sq lite module4
Sq lite module4
 
Fundamentals of database system - Data Modeling Using the Entity-Relationshi...
Fundamentals of database system  - Data Modeling Using the Entity-Relationshi...Fundamentals of database system  - Data Modeling Using the Entity-Relationshi...
Fundamentals of database system - Data Modeling Using the Entity-Relationshi...
 
Unit 3 final.pptx
Unit 3 final.pptxUnit 3 final.pptx
Unit 3 final.pptx
 
introduction of database in DBMS
introduction of database in DBMSintroduction of database in DBMS
introduction of database in DBMS
 
Entity relationship diagram (erd)
Entity relationship diagram (erd)Entity relationship diagram (erd)
Entity relationship diagram (erd)
 

Recently uploaded

How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxmanuelaromero2013
 
_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting Data_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting DataJhengPantaleon
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Sapana Sha
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityGeoBlogs
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxheathfieldcps1
 
Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentInMediaRes1
 
Micromeritics - Fundamental and Derived Properties of Powders
Micromeritics - Fundamental and Derived Properties of PowdersMicromeritics - Fundamental and Derived Properties of Powders
Micromeritics - Fundamental and Derived Properties of PowdersChitralekhaTherkar
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingTechSoup
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfsanyamsingh5019
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxNirmalaLoungPoorunde1
 
Hybridoma Technology ( Production , Purification , and Application )
Hybridoma Technology  ( Production , Purification , and Application  ) Hybridoma Technology  ( Production , Purification , and Application  )
Hybridoma Technology ( Production , Purification , and Application ) Sakshi Ghasle
 
PSYCHIATRIC History collection FORMAT.pptx
PSYCHIATRIC   History collection FORMAT.pptxPSYCHIATRIC   History collection FORMAT.pptx
PSYCHIATRIC History collection FORMAT.pptxPoojaSen20
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13Steve Thomason
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...Marc Dusseiller Dusjagr
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeThiyagu K
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Krashi Coaching
 
mini mental status format.docx
mini    mental       status     format.docxmini    mental       status     format.docx
mini mental status format.docxPoojaSen20
 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon AUnboundStockton
 
Concept of Vouching. B.Com(Hons) /B.Compdf
Concept of Vouching. B.Com(Hons) /B.CompdfConcept of Vouching. B.Com(Hons) /B.Compdf
Concept of Vouching. B.Com(Hons) /B.CompdfUmakantAnnand
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)eniolaolutunde
 

Recently uploaded (20)

How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptx
 
_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting Data_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting Data
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activity
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
 
Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media Component
 
Micromeritics - Fundamental and Derived Properties of Powders
Micromeritics - Fundamental and Derived Properties of PowdersMicromeritics - Fundamental and Derived Properties of Powders
Micromeritics - Fundamental and Derived Properties of Powders
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdf
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptx
 
Hybridoma Technology ( Production , Purification , and Application )
Hybridoma Technology  ( Production , Purification , and Application  ) Hybridoma Technology  ( Production , Purification , and Application  )
Hybridoma Technology ( Production , Purification , and Application )
 
PSYCHIATRIC History collection FORMAT.pptx
PSYCHIATRIC   History collection FORMAT.pptxPSYCHIATRIC   History collection FORMAT.pptx
PSYCHIATRIC History collection FORMAT.pptx
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and Mode
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
 
mini mental status format.docx
mini    mental       status     format.docxmini    mental       status     format.docx
mini mental status format.docx
 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon A
 
Concept of Vouching. B.Com(Hons) /B.Compdf
Concept of Vouching. B.Com(Hons) /B.CompdfConcept of Vouching. B.Com(Hons) /B.Compdf
Concept of Vouching. B.Com(Hons) /B.Compdf
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)
 

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.