Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Storing Billing address and Shipping address

Status
Not open for further replies.

MikeMCSD

MIS
Jul 12, 2002
107
US
Hi,
Does anyone have any suggestions on how I should store a Shipping address? Most of the time the Billing address is used for the Shipping address.
Should I add more fields in the Customer table like, shipAddress, shipCity, etc... or store the Shipping address in the Orders table?
Thanks
 
I would add three more tables:
1. AddressType - contains fields: AddressTypeId as primary key and Descriptions (i.e. 1-Billing, 2-Shipping)
2. Address - contains fields: AddressId, AddressTypeId as a forein key from AddressType table and other specific to Address fields.
2. CustomerAddress - an intermediate table between Customer and Address tables, contains two foreign key fields: CustomerId from Customer table and AddressId from Address table.

Thsi way you can store as many biling and/or shipping addresses as you need for a customer.
 
Like LV says.

Don't forget to use a character field for postal code. Not all countries use a numeric value like the US does (Canada, for example, follows the UK style of mixed letters & numbers).

Chip H.


____________________________________________________________________
If you want to get the best response to a question, please read FAQ222-2244 first
 
Thanks LV and Chip, . . .
It is an excellent solution but might be overkill for me.
I'm guessing only about 10% of customers will want to change the shipping address (from their billing address).
My main concern was to not make the customer database table
too big because it might hurt performance. I was thinking of storing it in the Orders table, but that might not be too good either.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top