Last answered:

12 May 2021

Posted on:

11 May 2021


Explain the concept of One to Many and Many to one Relationship please

Kindly provide a bit more context about the One to many and Many to one relationships. In what situation is one used over the other and practical implications of each of these relationships to the model built.

1 answers ( 0 marked as helpful)
Posted on:

12 May 2021


Hi Arvind,
One to Many or Many to One is the same thing. Depends on how you read it. On the one side is always the dimension table (the table that contains the descriptive data, product color, name, size, etc). On the many side is always the fact table (where each sale is created daily). Inside the fact table (or sales table) you cannot have all the attributes for each sale because we will end up with a table that holds hundreds of columns therefore we are importing fact tables and dimension tables separately. They are connected using a One to Many if you read the relationship from the dimension table to fact table. One means that inside the dimension table for Products we only have one unique product key for each product to identify the rest of the attributes for that product. Inside the fact table we have many repetitions of that product because every time we sell a product with ID 100 it will create a new row with product ID 100 and different date or different customer, etc. Since the fact table holds our sales, we are going to have multiple instances of the product key repeated for each sales. When we connect the product and sales table, it means that the product table can filter the sales table from the one side (so any attribute inside product) can be used to filter the many side of the sales table. The sales table however cannot filter the product table, it can only be done from the one side to the many side.

I hope this helps.

Kind Regards,
Dimitar Shutev

Submit an answer