The Wayback Machine - https://web.archive.org/web/20260321075125/https://www.geeksforgeeks.org/sql/how-to-draw-entity-relationship-diagrams/

Steps to Draw an Entity Relationship Diagram

Last Updated : 12 Mar, 2026

An Entity Relationship Diagram (ERD) is a graphical representation that shows how entities, such as people, objects, or concepts, relate to each other within a system. ERDs are commonly used in database design to visualize the relationships between entities and their attributes.

  • Represent the logical structure of databases.
  • Use symbols (rectangles, diamonds, ovals, lines) to show entities and relationships.
  • Used in designing and debugging relational databases.

Need to Draw ER Diagram

ER diagram or ER model, is drawn to visually represent the relationships between entities in a database system. Some benefits of drawing ER diagrams for database design are:

  1. It helps in understanding the data relationships.
  2. ER diagrams are like a blueprint for designing a database.
  3. Helps in communicating about databases with database designers, developers, users, etc.
  4. They help in describing different relationships and operations within an organization.

Steps to Create an Entity Relationship Diagram (ERD)

A step-by-step process to draw an entity relation diagram (ERD) is:

Step 1: Identifying Entities

Determine the main objects you want to represent in the database. E.g., "students", "courses", or "products".

Step 2: Defining Attributes

Identify the properties(attributes) of properties of each entity. These attributes provide more details about an entity.

Step 3: Specifying Relationships

Create relationships between entities to specify how entities interact with each other. Relationships are verbs like "teaches", "studies", or "sells".

Step 4: Drawing Entities

Draw entities as rectangle and write the name.

Step 5: Adding Attributes

To add attributes of a entity write attributes inside the rectangle or connect them with lines.

Step 6: Connecting Entities

Draw lines between the related entities to represent their connection.

Step 7: Specifying Cardinality

Indicate the minimum and maximum number of relationship instances associated with an entity using notations like crow's foot.

Step 8: Organizing ER Diagram

Organize all entities and relationships in a clean way for better readability and understanding.

Sample ER Diagram

After learning how to draw an ER diagram, let’s create a demo using a bank example to understand its design and methods.

Entity Relationship Diagram for BANK

We will follow the steps mentioned above, to draw entity relationship diagram for bank.

A real-world object with independent existence, either physical (house, person) or conceptual (course, job), is called an entity and is represented by a rectangle

Entities for Bank: Bank, Branch, Employee, customer, loan, account.

entities
Entities

Adding Attributes

Attributes are the kind of properties that describe the entities. They are represented by ovals.

Attributes for Bank are:

  • For Bank Entity the Attributesare Bname, code.
  • For Branch Entitythe Attributesare Blocation, Bname.
  • For Employee Entitythe Attributesare Eid, Designation, salary.
  • For Customer Entitythe Attributesare Cid, Cname, Address, DOB.
  • For Loan Entitythe AttributesareLoan_no, amount, rate.
  • For Account Entitythe Attributesare acc_no, type.
frame

Establishing Relationships

Entities have some relationships with each other. Relationships define how entities are associated with each other.

Let's Establishing Relationships between them are:

  • The Bankhas branches.
  • The Branchprovides loan.
  • The Employeeworks in branch.
  • The Branch contains customers.
  • The Customershas account.
  • The Branch maintains account.
  • The Customeravails loan.
relationships
Relationships

Specifying Cardinality

Cardinality defines the numerical constraints on the relationships between entities. It is a notationthat tells the ERDreader whether there are one, manyor some combination of those factors between each entity.

1. One to One relationship(1:1)

A One-to-One (1:1) relationship in an ERD means one entity in a table is linked to exactly one entity in another table.Examples:

  • One Driver → One License
  • One Person → One Passport

2. One to Many relationship(1:N)

A One-to-Many relationship means one entity in a table can be associated with multiple entities in another table.Examples:

  • One Bank → Many Branches
  • One Branch → Many Employees

3. Many to One(N:1)

A Many-to-One relationship means multiple entities in one table are linked to a single entity in another table.Examples:

  • Many Employees → One Branch
  • Many Accounts → One Customer
  • Many Loans → One Branch

4. Many to Many relationship(M:N)

A Many-to-Many relationship means multiple entities in one table are associated with multiple entities in another table.Examples:

  • Many Students ↔ Many Courses
  • Many Customers ↔ Many Products
  • Many Doctors ↔ Many Patients

Specify cardinality for Bank:

  • Bank → Branch : One-to-Many (One bank has many branches)
  • Branch → Loan : One-to-Many (One branch provides many loans)
  • Branch → Employee : One-to-Many (One branch employs many employees)
  • Branch → Account : One-to-Many (One branch maintains many accounts)
  • Branch → Customer : One-to-Many (One branch has many customers)
  • Customer → Account : One-to-Many (One customer has many accounts)
  • Customer → Loan : One-to-Many (One customer can take many loans)
fra

Identify Primary Keys

Primary keys are the uniqueidentifier for each record in database table. It is denoted by an underline under the attribute name.

  • The Primary key of Bankis code.
  • The Primary key of Branch is Bcode.
  • The Primary key of Employee is Eid.
  • The Primary key of Customeris Cid.
  • The Primary key of Loanis loan_no.
  • The Primary key of Account is acc_no.

Final ER Diagram

The below diagram is our final entity relationship diagram for bank with all entities, their attributes and the relationship between them with the PRIMARY KEY and Cardinality ratio.

FinalER-(1)
Final ER Diagram


Comment