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 > Several address columns or just 1?

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 11-08-06, 09:43
cfr cfr is offline
Registered User
 
Join Date: Nov 2004
Posts: 126
Several address columns or just 1?

Howdy all. I have a developer proposing a DB schema that has 4 different tables containing address columns (Vendors, Service Provider, Locations, Payment Address). Each of these has Address1 and Address2. It seems to me that it would be better to have 1 address table, with a flag for which address type it was. That way I could keep all address' together, and eliminate Address2 at the same time. Would you agree?
Reply With Quote
  #2 (permalink)  
Old 11-08-06, 10:16
healdem healdem is offline
Jaded Developer
 
Join Date: Nov 2004
Location: out on a limb
Posts: 9,246
Generally Id agree, a single table could be a good idea... however how do you propose to ensure RI.

bearing in mind that one entity may have mor ethan one role (ie they could eb a customer and a supplier)

some organsiations may have many addreszsess (eg a multi branch company)

granted you could "just" do it as an address type, and contact type and associate in SQL. perfectly practical, just against the theory of RDBMS imposing constraints ie your address owner is the prime key of the custoemr / supplier / whatever and you enforce RI using a query / trigger make sure the relevant RI rules are enforced

in any event I'd want at least 5 columns for the address & postcode
__________________
I'd rather be riding my Versys or my Tiger 800 let alone the Norton
Reply With Quote
  #3 (permalink)  
Old 11-08-06, 11:37
blindman blindman is offline
World Class Flame Warrior
 
Join Date: Jun 2003
Location: Ohio
Posts: 11,726
"Address2" is normally used to store additional address information such as apartment number or floor. In such cases, it does not violate the principles of normalization.
__________________
If it's not practically useful, then it's practically useless.

blindman
www.chess.com: "sqlblindman"
Reply With Quote
  #4 (permalink)  
Old 11-08-06, 12:04
cfr cfr is offline
Registered User
 
Join Date: Nov 2004
Posts: 126
Quote:
Originally Posted by healdem
Generally Id agree, a single table could be a good idea... however how do you propose to ensure RI.

bearing in mind that one entity may have mor ethan one role (ie they could eb a customer and a supplier)
I could have a table in between ("bridge table", "many to many table", whatever it's called) that would then allow an address to have many types. But then I really don't know what I'd be getting out of the deal.
Reply With Quote
  #5 (permalink)  
Old 11-08-06, 12:05
pootle flump pootle flump is offline
King of Understatement
 
Join Date: Feb 2004
Location: One Flump in One Place
Posts: 14,905
It struck me that the OP was talking about a second address in its entirety rather than an attribute of an address entity (i.e. two addresses per record, one per column, rather than two records with one address each).
__________________
Testimonial:
Quote:
pootle flump
ur codings are working excelent.
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