0% found this document useful (0 votes)
47 views22 pages

How To Draw ER Diagram

Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1/ 22

How To Draw ER Diagram

Presented By
Nidhi Singh
Developing Entity Relationship Diagrams
(ERDs) 
• WHY:
▫ Entity Relationship Diagrams are a major data modeling tool and will help organize the data in your
project into entities and define the relationships between the entities. This process has proved to
enable the analyst to produce a good database structure so that the data can be stored and retrieved
in a most efficient manner. INFORMATION: 
• Entity
▫ A data entity is anything real or abstract about which we want to store data. Entity types fall into five
classes: roles, events, locations, tangible things or concepts.
• Relationship
▫ A data relationship is a natural association that exists between one or more entities. E.g. Employees
process payments. 
• Cardinality 
▫ defines the number of occurrences of one entity for a single occurrence of the related entity.

• Attribute
 
▫ A data attribute is a characteristic common to all or most instances of a particular entity. Synonyms
include property, data element, field. E.g. Name, address, Employee Number, pay rate are all
attributes of the entity employee. 
AN ENTITY RELATIONSHIP DIAGRAM
METHODOLOGY
Identify the roles, events, locations, tangible things or concepts about which the end-
1. Identify Entities  users want to store data. 

2. Find Relationships  Find the natural associations between pairs of entities using a relationship matrix.

3. Draw Rough ERD  Put entities in rectangles and relationships on line segments connecting the entities. 

Determine the number of occurrences of one entity for a single occurrence of the related
4. Fill in Cardinality  entity. 
Identify the data attribute(s) that uniquely identify one and only one occurrence of each
5. Define Primary Keys  entity. 
Eliminate Many-to-Many relationships and include primary and foreign keys in each
6. Draw Key-Based ERD  entity. 
Name the information details (fields) which are essential to the system under
7. Identify Attributes  development. 

8. Map Attributes  For each attribute, match it with exactly one entity that it describes. 

9. Draw fully attributed Adjust the ERD from step 6 to account for entities or relationships discovered in step 8. 
ERD 
10. Check Results  Does the final Entity Relationship Diagram accurately depict the system data? 
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 

1.Employee

2. Department

3. Supervisor

4. Project
2. Find Relationships 
 
• We construct the following Entity Relationship
Matrix:

  Department Employee Supervisor Project


Department X IS RUN BY X
ASSIGNED
Employee BELONGS X work WORK ON
TO
Supervisor RUNS x X X
Project X USED X X
3. Draw Rough ERD 
5. Define Primary Keys 
•  The primary keys are

▫ Department Name,

▫ Supervisor Number,

▫ Employee Number,

▫ Project Number
4. Fill in Cardinality 
• From the description of the problem we see that: 
• Each department has exactly one supervisor. 
• A supervisor is in charge of one and only one department. 
• Each department is assigned at least one employee. 
• Each employee works for at least one department. 
• Each project has at least one employee working on it. 
• An employee is assigned to 0 or more projects
Draw Key-Based ERD 
Associative Entity.
• Entities in a many-to-many relationship must be linked in a special way,

that is through a third entity, called a composite entity also known as an

associative entity.

A composite entity has only one function: to provide an indirect link

between two entities in a M:N relationship.

• A composite entity has no key attribute of its own; rather, it receives the key

attributes from each of the two entities it links, and combines them to form

a composite key attribute


How to represent Many to Many
Relationship in ER Diagram
Example Students enroll in Classes
ER Diagram
Student and Class Table
Joining the Table
7. Identify Attributes

• Department Name

• Supervisor Number

• Employee Number

• Project Number
8. Map Attributes 
Attribute    Entity    Attribute           Entity
Department Department Supervisor Supervisor
Name       Number      

Employee Employee Supervisor Supervisor


Number         Name      

Employee Employee Project Project


Name         Name         

    Project Project
Number        
9. Draw Fully Attributed ERD 
10. Check Results 
•  Look at your diagram from the point of view of a
system owner or user. Is everything clear? Check
through the Cardinality pairs. Also, look over the
list of attributes associated with each entity to
see if anything has been omitted. 

You might also like