Types of Relationships in DBMS
Overview
In this tutorial, we will learn about different types of relationships. A diamond shape in the ER diagram represents a relationship, which shows the relationship among entities.
Types of Relationships
The different types of relationships are as follows:
- One to One
- One to Many
- Many to One
- Many to Many
One-to-One Relationship
When a single instance of an entity is associated with a single instance of another entity, it is called a one-to-one relationship.
An example of a one-to-one relationship is between a person and his/her passport. Each person has only one passport, and a passport is assigned to exactly one person.
One-to-Many Relationship
When a single instance of an entity is associated with more than one instance of another, it is called a one-to-many relationship. For example– a customer can place many orders, but many customers cannot place an order.
Many-to-One Relationship
When more than one instance of an entity is associated with a single instance of another entity, it is called a many-to-one relationship. For example, many students can study in a single college, but a student cannot study in many colleges at the same time.
Many to Many Relationship
When more than one instance of an entity is associated with more than one instance of another entity, it is called a many-to-many relationship. For example, a student can be assigned to many projects, and a project can be assigned to many students.