Saturday, 7 February 2015

How to Draw An ERD For Your Database Project Tutorials

What is ERD (Entity Relationship Diagram):
ERD is stand for Entity Relationship Diagram. This is also called Logical Data Modeling.

Why we Study ERD (Entity Relationship Diagram):
Because software is an intangible thing also know as logical thing. we can't imagine it. ERD (Entity Relationship Diagram) is very helpful to understand the database design with people and designer also helpful in communications.

Components of ERD (Entity Relationship Diagram):
  1. Entity: Our object is also called an Entity. E.g; Employee., Product, Payment these are all entities.
  2. Relationships: A data Relationship is which is Exist in one or more then one Entity. E.g Employee Process Payment.
  3. Cardinality: Define the number of occurrence of the Entity. E.g; One to One, One to many , Many to Many this is a Cardinality
  4. Attributes: Attributes are Employee ID, Employee Name, Employee Address these are all attributes. There are Many types of attributes
    1. Key Attributes
    2. Derived Attributes 
Sample ERD with Attributes

Sample ERD Example

Methodology for Developing an ERD
  1. Identify Entities
  2. Find Relationships
  3. Draw Rough ERD
  4. Fill in Cardinality
  5. Define Primary Keys
  6. Draw Key Based ERD
  7. Identify Attributes
  8. Map Attributes
  9. Draw Fully Attributed ERD
  10. Check Results
We Need a case study then we implement methodology on our case study.
Case Study:
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: Departments ,Supervisor ,Employee ,Project they all are Entity. 
  2. Find Relationships: Find relationship. After reading case study we make a matrix.
  3. Draw Rough ERD (Entity Relationship Diagram): Now your relation matrix is completed this is Enough information to create rough ERD. Draw a diagram and Place all the entities in rectangles . Use diamonds and lines to represent the relationships between entities.
  4. Fill In Cardinality: Identify the number of occurrences of one entity for a single occurrence of the related entity.
Here's an example drawing and the case study described above.
    • 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.
    • Cardinality Values and symbols:
    • Rough ERD with Cardinality:

5. Define Primary Keys: Primary key is a Unique which is used to uniquely identify a specific instance.
Include the Primary keys in Rough ERD (Entity relation Diagram).

6. Draw Key-Based ERD Diagram:
  • Eliminating Many to many Relationships.
  • Adding primary key and foregin key.

we Eliminating many to many relationship in to one to one.

7. Identify Attributes:
  • data attribute is a characteristic common to all or most instances of a particular entity
  • Try to identify and name all the attributes essential to the system
  • The best way to do this is to study the forms, files and reports currently kept by the users of the system and circle each data item on the paper copy.
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). In this case you need to add a modifier to the attribute name to make it unique (e.g. Customer Name, Employee Name, etc.) or determine which entity an attribute "best' describes.

9. Draw Fully Attributed ERD:

10. Check ERD Result:
  • 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.
Thanks for reading my post if you like my post then comment below. and share with your friends.


Post a Comment

Item Reviewed: How to Draw An ERD For Your Database Project Tutorials Rating: 5 Reviewed By: Saqib Hussain