Construct an ER diagram for a company in DBMS?

An Entity-Relationship (ER) diagram is a visual representation of the data model for a database. It shows entities, their attributes, and the relationships between them. In this article, we construct an ER diagram for a company database step by step.

Problem

Draw an ER model for a company considering the following constraints −

  • In a company, an employee works on many projects which are controlled by one department.

  • One employee supervises many employees.

  • An employee has one or more dependents.

  • One employee manages one department.

Solution

Follow the steps given below to draw an ER model for the company −

Step 1 − Identify the Entity Sets

An entity set represents a collection of similar objects in the business scenario. As per the given constraints, the entity sets are −

  • Employee

  • Department

  • Project

  • Dependent (weak entity)

Step 2 − Identify the Attributes

Entity Attributes Key Attribute
Employee Name, SSN, Sex, Address, Salary SSN
Department Name, Number, Location Number
Project Name, Number, Location Number
Dependent Name, Sex, Birth Date, Relationship Name (partial key)

Dependent is a weak entity because it cannot be uniquely identified by its own attributes alone ? it depends on the Employee entity for identification. In ER diagrams, weak entities are denoted by a double rectangle.

Step 3 − Identify the Relationships

The relationships between entity sets along with their cardinality are −

Works For − Multiple employees work for a single department, and one department has multiple employees. This is a many-to-one (N:1) relationship.

Employee Works For Department N 1

Manages − A single employee manages one department, and one department is managed by one employee. This is a one-to-one (1:1) relationship.

Employee Manages Department 1 1

Controls − Each department controls multiple projects, and each project is controlled by a single department. This is a one-to-many (1:N) relationship.

Department Controls Project 1 N

Dependent Of − One employee has multiple dependents, and each dependent belongs to a single employee. This is a one-to-many (1:N) relationship. Since Dependent is a weak entity, this is an identifying relationship.

Employee Dependent Of Dependent 1 N

Supervises − One employee supervises many other employees. This is a recursive one-to-many (1:N) relationship on the Employee entity.

Step 4 − Relationship Summary

Relationship Between Cardinality
Works For Employee ? Department N : 1
Manages Employee ? Department 1 : 1
Controls Department ? Project 1 : N
Dependent Of Employee ? Dependent 1 : N
Supervises Employee ? Employee 1 : N (recursive)

Step 5 − Complete ER Diagram

The complete ER diagram combining all entities, attributes, and relationships is as follows −

Complete ER Diagram ? Company Database Employee SSN, Name, Sex, Address, Salary N Supervises 1 1 Dep. Of N Dependent N Works For 1 Manages Number, Name, Location Department 1 1 1 Controls N Project

Conclusion

Constructing an ER diagram involves identifying entities, their attributes and key attributes, and then establishing the relationships with proper cardinality between them. In this company database, Employee, Department, Project, and Dependent are the main entities connected through relationships like Works For, Manages, Controls, and Dependent Of. Dependent is modeled as a weak entity since it relies on Employee for unique identification.

Updated on: 2026-03-17T19:39:30+05:30

16K+ Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements