Trusted answers to developer questions
Trusted Answers to Developer Questions

Related Tags


What is an ER diagram?

Educative Answers Team

An Entity-Relationship (ER) diagram expresses the logical structure of a database by showing the relationships between entity sets in a system. ER diagrams are widely used because they help structure information stored in a database and can be directly translated into tables.


The following are the major components of an ER diagram:

  • Entity

    An entity is a real-world object. It may or may not have a physical existence. Examples include person John and his bank account.

  • Entity Set

    An entity set is a collection of similar entities. Examples include a group of people or a bank. An entity set is represented by a rectangle in an ER diagram.

  • Attribute

    An attribute is the property of an entity. Examples include name, age, etc. An attribute is represented by an oval in an ER diagram.

  • Relationship

    A relationship is an association between two or more entity sets. A relationship is represented by a diamond in an ER diagram.

  • Cardinality

    Cardinality defines the attributes of a relationship using numbers. It includes:

    1. One-to-one relationship: An entity in entity set “a” is associated with, at most, one entity in entity set “B”.

    2. One-to-many relationship: An entity “a” is associated with more than one entity in “B”.

    3. Many-to-one relationship: Many entities in “a” are associated with an entity in “b”.

    4. Many-to-many relationship: Many entities in “a” are associated with many entities in “b”.

The following illustration shows an ER diagram:

svg viewer
This ER diagram shows entity sets Singer_details and Song_details. One singer can sing multiple songs.


Copyright ©2022 Educative, Inc. All rights reserved

View all Courses

Keep Exploring