Wednesday, November 14, 2012

On what basis relationship between tables are defined


PROBLEM

The question is, if two tables in database are from different entities then how we define relationship between them. i mean can we use some foreign key or any thing to define relationship between them. or we have to create a third table


SOLUTION

There is a design principle that states that a table either defines an entity or a relationship but not both. Therefore, use a third table to model the relationship between your two entities -- yes, even if it is 1-1 or 1-N -- noting that the relationship itself may have its own attributes.

No comments:

Post a Comment