Reputation: 22723
I am working on database design so want to understand the pros & cons of having a separate table only for relationship.
It should be like:
Or
A customer can have more than one address.
What are the advantage and disadvantage?
Upvotes: 1
Views: 332
Reputation: 1269613
This is a reasonable question.
Basically, it boils down to a single question: "Do you want two identical addresses to always have the same key or not?".
In the first version, the "Address Detail" can be unique across the database. So, two room-mates could have the same AddressId
. When the Smith's move out and the Jones' move in, they could have the same AddressId
.
In the second version, each person would have one or more address records. However, the details for a given address could be repeated.
Which is better depends on your application. Often, the first method is preferable when you are contacting people at the address, because "de-duplication" is built into the data model
Upvotes: 4