ER Model (Entity Relationship Model) | DBMS Tutorial | Minigranth

ER Model: Introduction

  • ER Model is known as the Entity-Relationship Model. It means a model that is used to describe and define the overall structure of any database by using schematic and diagrammatic representation. ER Model defines the logic of the database.
  • The schematic and diagrammatic representation is generated using certain components including entity, attributes, relationships, etc. These components are discussed in the next section.

ER Model: Components

  • The components of the entity-relationship model are the building blocks which helps in the generation of an ER Model diagram, which finally results in the design of the logical structure of a database. There are three basic components of the Entity-Relationship Model. These are discussed below.
  • All these components have definite diagrammatical representations that are used for the generation of ER Diagram. Let’s discuss them in detail now.    

This image describes the various components of ER model used in generation of er diagram in dbms.
ER Model: Components

1. Entity

  • An entity can be called as the basic object which represents the ER Model. It can be a real-world object/thing present physically or can be an object/thing present logically/virtually. Entities are objects or things or articles or pieces that have an existence without any dependence on any other object.

For example: Bank account can be an entity, Loan can be an entity, Bank branch can be an entity, etc. These entities have their own properties which are known as attributes.

2. Attribute

  • Once the entities are defined, their properties support them and are known as attributes. These attributes also consist of specific values corresponding to the type of entity they are related to. Attributes describe the properties and characteristics of the entity.

For example: Attributes of Bank account (Which is an entity) can be “ Account No, Account Holder Name, Balance, etc.”. Also, the values of attributes are domain-specific. It means, if the account is an entity then the balance cannot be negative. There exist six types of attributes for specific types of entities.

a) Simple Attribute: Simple attribute are those attributes which cannot be divided further because of their atomic nature.

Let’s make it clear with an example. The account number of a customer can be a simple attribute as it cannot be divided further. The date of birth of a person is another example of a simple attribute.

b) Composite Attribute: Composite attributes are those attributes that are the combination of two or more than two simple attributes joined together.

For example: Name of a customer of the account holder can be a composite attribute.

Ganesh + Dutt + Upreti → First Name + Middle Name + Last Name {Composite Attributes}

c) Derived Attribute: Derived Attributes are those attributes whose values are derived from the already stored attributes in the database.

For example: Database consisting of the height of a class. Then the value of average height can be derived from the already available data of students.

d) Single Valued Attribute: Single valued attribute are those which contains only a single specified value or a single unique value.

For example: Aadhar Number, SSN No, etc.

e) Multi-Valued Attribute: Multi-valued attributes are those which can have multiple values against them.

For example: Address, email, Phone number are multi-valued attributes.

f) Null Value Attribute: Null value attributes are those which can be left blank without passing any value.

For example : A person can have a name without a middle name and hence middle name field can be left blank or null.

Ganesh + Upreti → First Name + _______ + Last Name

3. Relationship

  • The relationship is the third and last component of the ER Model. It is responsible for establishing a link of communication between attributes and entities as per requirements.
  • For example: “Has ancan be termed as a relationship between a customer and an account in the bank.

This image describes the relationship components used in generation of er diagram in dbms.
ER Model: Relationship

  • A relationship can be categorized into three majors :
    • Binary Relationship: When any relationship is established among 2 entities, it is called a binary relationship.
    • Ternary Relationship: When any relationship is established among 3 entities, it is called a ternary relationship.
    • n-Degree Relationship: When any relationship is established among any number of entities(2 or more than two), then n is replaced with that number. For example: 2-Degree, 3-Degree, 4-Degree, etc.