When only one instance of the left and more than one instance of an entity on the right associates with the relationship then this is known as one

Rumman Ansari   Software Engineer   2020-03-20   5572


An ER Diagram consists of the following components:

  1. Entity
  2. Attributes
  3. Relationships

When only one instance of the left and more than one instance of an entity on the right associates with the relationship then this is known as one

We already discussed about Entity and Attributes. In this session we will discuss about Relationships.

Relationship

A relationship is used to describe the relation between entities. Diamond or rhombus is used to represent the relationship.

An association between two or more entities is known as a relationship. A relationship describes how two or more entities are related to each other.

When only one instance of the left and more than one instance of an entity on the right associates with the relationship then this is known as one

Degree of a relationship

The number of entity types participating in a relationship type determines the degree of the relationship type. The relationship that involves just one entity type is called a unary relationship. In other words, the relationship that exists between the instances of the same entity type is the unary relationship. The relationship between two entity types is known as a binary relationship and the relationship between three entity types is known as the ternary relationship. In general, the relationship between n entity types is known as an n-ary relationship. Thus, a unary relationship has a degree 1, a binary relationship has a degree 2, a ternary relationship has a degree 3 and an n-ary relationship has a degree n. 

Types of relationship are as follows:

One-to-One Relationship

When only one instance of an entity is associated with the relationship, then it is known as one to one relationship.

For example, A female can marry to one male, and a male can marry to one female.

When only one instance of the left and more than one instance of an entity on the right associates with the relationship then this is known as one

One-to-many relationship

When only one instance of the entity on the left, and more than one instance of an entity on the right associates with the relationship then this is known as a one-to-many relationship.

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

When only one instance of the left and more than one instance of an entity on the right associates with the relationship then this is known as one

Many-to-one relationship

When more than one instance of the entity on the left, and only one instance of an entity on the right associates with the relationship then it is known as a many-to-one relationship.

For example, Student enrolls for only one course, but a course can have many students.

When only one instance of the left and more than one instance of an entity on the right associates with the relationship then this is known as one

Many-to-many relationship

When more than one instance of the entity on the left, and more than one instance of an entity on the right associates with the relationship then it is known as a many-to-many relationship.

For example, Employee can assign by many projects and project can have many employees.

When only one instance of the left and more than one instance of an entity on the right associates with the relationship then this is known as one


When more than one instance of an entity is associated with a relationship?

Many-to-one − When more than one instance of entity is associated with the relationship, it is marked as 'N:1'. The following image reflects that more than one instance of an entity on the left and only one instance of an entity on the right can be associated with the relationship.

When a single instance of an entity is associated with more than one instances of another entity?

When a single instance of an entity is associated with more than one instances of another entity then it is called one to many relationship. For example – a customer can place many orders but a order cannot be placed by many customers.

What is a 1 to 1 relationship database?

In a one-to-one relationship, one record in a table is associated with one and only one record in another table. For example, in a school database, each student has only one student ID, and each student ID is assigned to only one person.

What is a relationship a one

In a one-to-many relationship, one record in a table can be associated with one or more records in another table. For example, each customer can have many sales orders.