How To Draw ER Diagram
How To Draw ER Diagram
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
1.Employee
2. Department
3. Supervisor
4. Project
2. Find Relationships
• We construct the following Entity Relationship
Matrix:
▫ 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,
associative entity.
• 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
• Department Name
• Supervisor Number
• Employee Number
• Project Number
8. Map Attributes
Attribute Entity Attribute Entity
Department Department Supervisor Supervisor
Name Number
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.