Wednesday, February 26, 2014

Relations among data


In this post we will see the relationship held between data
  1. A relationship can be defined as an association among entities. 
  2. Several relationships may exist between the same entity. 

There are three types of relationships among data.

  • One to One
  • One to Many / Many to One
  • Many to Many

Lets go through one by one. 

One to One :

Consider an example of a class of students. 

Each student can only be assigned one student ID. In the same way, each student ID can only be associated to one student. So, from both ways, only one relation can be built. Same example is depicted in the picture. 



One to Many / Many to One:

Consider an example of students enrolling to a course.

One student can enroll for only one particular course at a time, and more than one students can enroll for a course. Same example is depicted in the picture. 


Many to Many:

Consider an example of a seller selling number of items.

One seller can sell a number of items and many sellers can sell the same particular item. So, many sellers can sell many items. Same example is depicted in the picture. 


Now, I hope you understood the relations among data. 

No comments:

Post a Comment