How to Draw ER Diagram ??
We have read all the basic terms of ER Diagram. Now, let’s understand how to draw er diagram?
In ER Model, objects of similar structures are collected into an entity set. The relationships between an entity sets is represented by a named E-R relationship, which may be (one-to-one, one-to-many, many-to-one, many-to-many), which maps one entity set to another entity set. A General ER Diagram is shown as-
In Figure, there are two entities ENTITY-1 and ENTITY-2 having attributes (Atr11, Atr12, … Atr1m) and (Atr21, Atr22, … Atr2n) respectively, connected via many to many relationship (M:N). The attributes of RELATIONSHIP are (AtrR1, AtrR2, … AtrRO).
Steps – How to Draw ER Diagram –
- Identify all the entities of the given problem
- Identify all the attributes of the entities identified in step 1.
- Identify the Primary Keys of entities identified in Step 1.
- Identify the Attribute Types of attributes identified in step 2
- Identify relationship between the entities and constraints on the entities and implement them.
Need of ER Diagram –
The ER Diagrams are useful in representing the relationship among entities. It helps to show basic data structures in a way that different people can understand. Many types of people are involved in the database environment, including programmers, designers, managers and end users. But not all of these people work with database and might not be as skilled as others to understand the making of a software or a program etc, so, a conceptual model like the ERD helps show the design to many different people in a way they can all understand.
Example of drawing ER Diagram –
How to draw er diagram of a company database if the following requirements are given :
Question : Make an ER Diagram for the company database with the following description :
- The company is organised into departments. Each department has a unique name and a unique number. A department may have several locations.
- A department controls a number of projects, each of which has a unique name, a unique number and a single location.
- We store each employee’s name, social security number, address and salary. An employee is assigned to one department but may work on several projects, which are not necessarily controlled by the same departments.
- We want to keep track of the departments of each employee for insurance purposes. We keep each dependent’s name, age and relationship to the employee.
Step 1 : Identifies Entities of the given problem.
Entities : 1. DEPARTMENT (From 1st Point) 2. PROJECT (From 2nd Point) 3. EMPLOYEE (From 3rd Point) 4. DEPENDENT (From 4th Point)
Step 2 : Identify the attributes of the above entities.
Attributes : 1. DEPARTMENT : Name, Number, Location; 2. PROJECT : Name, Number, Location; 3. EMPLOYEE : SSN, Name, Address, Salary 4. DEPENDENT : Name, Age, Relationship
Step 3 : Identify the Primary Keys of all entities identified in Step 1.
Primary Keys : 1. DEPARTMENT : Name, Number, Location; (Unique Name and Unique Number) 2. PROJECT : Name, Number, Location; (Unique Name and Unique Number) 3. EMPLOYEE : SSN, Name, Address, Salary (Since, Social Security Number will be Unique, so SSN is selected as primary Key) 4. DEPENDENT : Name, Age, Relationship (No Unique Attribute to identify DEPENDENT entity. So, It is referred as a Weak Entity)
Step 4: Identify the Attribute Types -
Attributes Types : 1. Location Attribute of DEPARTMENT entity : Multivalued Attribute (Since there are several locations) 2. Name Attribute of EMPLOYEE entity : Composite Attribute (since a name consists of first name, middle name and last name) 3. Adderess Attribute of EMPLOYEE entity : Composite Attribute (Address consists of H.no, Street, City, State, Country)
Step 5 : Identify the Relationships and relationships attributes between the entities.
Relationships and their Attributes : Relationship Name Entities Name having Attributes relationships among them 1. Works_For EMPLOYEE and DEPARTMENT - 2. Control DEPARTMENT and PROJECT - 3. Works_On EMPLOYEE and PROJECT Hours 4. Dependents_Of EMPLOYEE and DEPENDENT -
Step 6: Identify the constraints on the entities.
Cardinality Constraints : Relationship Cardinality Reason 1. Works_For N:1 Since N employees Works_For a Department. 2. Works_On M:N Since different employees works on different projects. 3. Control 1:N Since a department Controls a number of projects. 4. Dependents_Of 1:N Since each Dependents has name, age and relationship to the employee.
Incoming search terms:
- how to draw er diagram in dbms
- how to draw er diagram
- procedure for er drawing
- e r model company
- how to draw er diagram#spf=1
- draw the diagram of model
- er diagram step by step
- discuss the step of designing the er diagram
- what are the steps to develop an ERD
- how to draw an ER diagram