Binary Relationship in Database


A Binary Relationship is the relationship between two different Entities i.e. it is a relationship of role group of one entity with the role group of another entity.

There are three types of cardinalities for Binary Relationships −

1. One-to-One

2. One-to-many

3. Many-to-Many

One-to-One

Here one role group of one entity is mapped to one role group of another entity. In simple terms one instance of one entity is mapped with only one instance of another entity.

In this type the primary key of one entity must be available as foreign key in other entity.

For example − consider two entities Person and Driver_License.

Person has the information about an individual and Driver_License has information about the Driving License for an individual. The relationship from Driver_License to Person is optional as not all People have driving license. Whereas the relationship from Person to Driver_License is compulsory i.e. every instance of Driver_License must be related to one Person.

One Person should have only one Driver License number.

One-to-Many

One role group of one entity is mapped with many role groups of second entity and one role group of second entity is mapped with one role group of first entity.

For Example − consider two entities Project and Employee.

One Project can have many Employees working on it but one Employee will always be engaged in only one Project.

Many-to-Many

One role group of one entity is mapped with many role groups of second entity and one role group of second entity is mapped with many role groups of first entity. In these kind of relationships a third table is always associated that defines the relationship between the two entities.

For example − Consider two entities Student and Books.

Many Students can have a Book and many Books can be issued to a Student so in this way this is a many-to-many relationship.

Now in between there would be a third relation Book_Issue that defines the relationship between Student and Book entities. It will contain the information for every Student that is issued a Book and for how many days i.e. it will keep track for all the Books issued.

Updated on: 18-Jun-2020

7K+ Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements