S
Scoop
I am working on an Order Processing and am having trouble trying to
figure out some of the relationships for Customers, Addresses, and
Orders. Here are my requirements:
I want to support multiple addresses for customers...specifically
multiple shipping addresses. Supporting multiple billing addresses is
fine but not a pressing need.
I don't need to support multiple customers at an address so I don't
think a many-to-many relationship there is necessary. As far as I can
tell a one-to-many for Customers to Addresses is sufficient. I
understand that it's theoretically possible to end up with redundant
information if a customer moves and the new person at that address is
also customer but it's unlikely enough that I'm not worried a/b it.
What I'm having a difficult time with is the relationship between
Addresses and Orders. If I have an Order that is billed to one Address
and shipped to another and two fields in the "Orders" table (e.g.
BillToID, ShipToID), what is the relationship between Addresses and
Orders. Additionally, how do you maintain referential integrity?
figure out some of the relationships for Customers, Addresses, and
Orders. Here are my requirements:
I want to support multiple addresses for customers...specifically
multiple shipping addresses. Supporting multiple billing addresses is
fine but not a pressing need.
I don't need to support multiple customers at an address so I don't
think a many-to-many relationship there is necessary. As far as I can
tell a one-to-many for Customers to Addresses is sufficient. I
understand that it's theoretically possible to end up with redundant
information if a customer moves and the new person at that address is
also customer but it's unlikely enough that I'm not worried a/b it.
What I'm having a difficult time with is the relationship between
Addresses and Orders. If I have an Order that is billed to one Address
and shipped to another and two fields in the "Orders" table (e.g.
BillToID, ShipToID), what is the relationship between Addresses and
Orders. Additionally, how do you maintain referential integrity?