开发者

How to model something if the desired information is the same as an already existing record

How to model something if the desired information is the same as an already existing record e.g. Address (Street, Country, Province, Zip)

We need to capture an User who has a permanent address and an address for correspondence (i.e. 2 rows per user). There is a provision to say that the "address for correspondence" is the same as the "permanent address". I don't want to replicate this data since a change has to be made in开发者_StackOverflow both the records. How do you model this in schema?


One table contains users, one table contains addresses, and another table represents the many-to-many relationship between users and addresses, with a column indicating the relationship type. The user will have two rows in the m-to-m table, one for each type of address, both pointing to the same identifier of the address in the addresses table.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜