Intro to DBMS

Relationships in ER Model

In the ER Model, a Relationship is a relation between entities. The Diamond symbol is used to represent the relationship between Entities.

Term Relationship Set

A relationship set is a set of the same type of relationships in an entity set. A relationship set may be strong or weak. Let’s explain both these terms,

I. Strong Relationship Set

  • A strong relationship exists between two strong entity sets.
  • A strong relationship is represented through a diamond symbol, as shown below.

II. Weak Relationship Set

  • A weak relationship exists between the strong and weak entity sets.
  • The representation of a weak relationship is a double-diamond symbol.

Types of Relationships 

The Types of relationship are also known as cardinality of relationship or cardinality ratio. Types of relationships are explained below

1. One-to-One Relationship

When only one instance of an entity is attached to exactly one entity instance of another entity in the relationship, then it will be to one relationship.

For example, One Female can marry only one Male

We can represent the above diagram in the following diagram

2. One-To-Many Relationship

When only one instance of the entity (i.e., Entity A) on the left side and more than one instance of an entity (i.e., Entity B) on the right side are associated with the relationship, then it will be a one-to-many relationship.

For example, Scientists can invent many inventions, but the invention is done by only one scientist.

 The above diagram Can be understood through the following diagram.

 

3. Many-to-one relationship

When only one instance of the entity (i.e., Entity A) on the left side and more than one instance of an entity (i.e., Entity B) on the right side are associated with the relationship, then it will be a one-to-many relationship.

For example, a Student enrolls in only one School, but a School can have many students.

We can represent the above diagram in the following diagram

4. Many-to-Many Relationship

When more than one instance of the entity (i.e., Entity A) on the left side and more than one instance of an entity (i.e., Entity B) on the right side are associated with the relationship, then it will be a many-to-many relationship.

For example, Projects can be assigned by many employees, and employees can have many projects.

We can represent the above diagram in the following diagram

 Degree Of a Relationship Set

The total number of different entity sets that participate in a relationship is known as the degree of a relationship.

Types Of Degree of Relationships

1. Unary Relationship: When only ONE entity participates in a relation, then that relation is known as an unary relationship.

Example: one person is married to one person.

2. Binary Relationship: When TWO entities are participating in a relationship, then that relation is known as a unary relationship.

Example: Student is enrolled in Course.

3. N-ary Relationship: When n-entities participate in a relationship, then such a relationship is known as an n-ary relationship.

4. Zero or none Relationship: When no instance of an entity (i.e., Entity A) is related to any instance of another entity (i.e., Entity B).

5. Recursive Relationship: It indicates the relationship of an entity to itself.

Cardinality and modality terms also come under relationships, which we will cover in the next lecture.