Best way to model Customer <--> Address

后端 未结 12 1696
被撕碎了的回忆
被撕碎了的回忆 2020-11-30 02:22

Every Customer has a physical address and an optional mailing address. What is your preferred way to model this?

Option 1. Customer has fo

12条回答
  •  情话喂你
    2020-11-30 02:27

    I tend towards first approach for all the usual reasons of normalisation. This approach also makes it easier to perform data cleansing on mailing details.

    If you are possibly going to allow multiple addresses (mail, residential, etc) or wish to be able to use effective dates, consider this approach

       Customer   (id, phys_address_id)
       Cust_address_type (cust_id, mail_address_id, address_type, start_date, end_date)
       Address    (id, street, city, etc.)
    

提交回复
热议问题