If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > General > Database Concepts & Design > Mailing/Physical address table(s)

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 10-11-06, 16:16
gwgeller gwgeller is offline
Registered User
 
Join Date: Jan 2004
Posts: 145
Mailing/Physical address table(s)

I currently have a stores table that contains two full addresses, mailing and physical. I'm redoing the table and thought maybe I'd put the states in their own table as well as the countries. In doing so I noticed I need two state foreign keys in the stores table, one for each address. So my design is flawed because I won't be able to distinguish which state I need, the phyiscal address or mailing address.

I thought maybe two more tables, one for physical addresses and one for mailing addresses but this presents the same problem. If I need to show both addresses I won't be able to specify which state I need.

So all I can think of is two state tables which seems stupid or to just keep the addresses in the store table and get rid of the states table. I would probably still have a states table for combo boxes but it wouldn't be related to any other tables. I don't want to do this either.

Could something be done with aliases?

Does anyone have any suggestions?
__________________
GG
Code:
On Error Goto Hell

Hell:
    Msgbox("An error occurred, but was sent to Hell. You may continue.")
Reply With Quote
  #2 (permalink)  
Old 10-11-06, 17:25
r937 r937 is offline
SQL Consultant
 
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 19,524
one address table, and the stores table will have two FKs to it

one state table, and the address table will have a FK to it

countries table if necessary, and the states table will have a FK to it

simple, yes?
__________________
r937.com | rudy.ca
please visit Simply SQL and buy my book
Reply With Quote
  #3 (permalink)  
Old 10-11-06, 18:31
gwgeller gwgeller is offline
Registered User
 
Join Date: Jan 2004
Posts: 145
How would I distinguish a physical address from a mailing? Would I need a flag in the address table? Envision a form that shows both addresses.
__________________
GG
Code:
On Error Goto Hell

Hell:
    Msgbox("An error occurred, but was sent to Hell. You may continue.")
Reply With Quote
  #4 (permalink)  
Old 10-11-06, 18:42
r937 r937 is offline
SQL Consultant
 
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 19,524
Quote:
Originally Posted by gwgeller
How would I distinguish a physical address from a mailing? Would I need a flag in the address table?
yes, that's how i would do it

then a store could have one address, or the other address, or two addresses, or even several physical addresses and a mailing address...
__________________
r937.com | rudy.ca
please visit Simply SQL and buy my book
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On