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 > Normalization Question - US ZipCodes

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 06-23-09, 14:33
kwyjibo kwyjibo is offline
Registered User
 
Join Date: Jun 2009
Posts: 4
Question Normalization Question - US ZipCodes

I'm trying hard to understand and apply rules of normalization for a database I'm creating, but I came across a question related to US Zip Codes.

I was following along with a book that was doing a step by step walk through of normalizing a database (sql server 2005 for developers). In that book, in order to avoid duplicate data, they remove city and state from one table, and add it to a ZipCodes table, storing only ZipCodes in the Address table. Then, they can just do a look-up of city/state by the Zip Code.

There is only one problem with this...several towns often share the same Zip Code (my town included, shares with two other neighboring towns). So, this doesn't work. They can be differentiated by Zip + 4, but you can't require people to input their Zip + 4, after all, who remembers it? I don't know my +4 off the top of my head.

Is it really bad normalization practice to keep the city/state in the Address table, even if the same city/state combos will appear over and over again?

In general, I guess the question is: Is third normal form a practical and necessary goal, or just an 'ideal' that is not always achieved?
Reply With Quote
  #2 (permalink)  
Old 06-23-09, 14:55
Pat Phelan Pat Phelan is offline
Resident Curmudgeon
 
Join Date: Feb 2004
Location: In front of the computer
Posts: 12,605
Third normal form is a practical and necessary goal.

Making City and State depend on Zip Code is incorrect, so any model based on that assumption has to be incorrect right from the git-go.

-PatP
__________________
In theory, theory and practice are identical. In practice, theory and practice are unrelated.
Reply With Quote
  #3 (permalink)  
Old 06-23-09, 15:14
kwyjibo kwyjibo is offline
Registered User
 
Join Date: Jun 2009
Posts: 4
The book most likely over-simplified the example, as books often do.

I just saw another example that uses PostalCodeID, and then lists every city that shares the same zip code in a different row. I suppose I could try and get access to the post office API and get the info that way.
Reply With Quote
  #4 (permalink)  
Old 06-23-09, 17:01
dportas dportas is offline
Registered User
 
Join Date: Dec 2007
Location: London, UK
Posts: 732
In the United Kingdom a postal code can in principle be used to determine town and county. In my experience it doesn't usually make sense to create a new table keyed only on postcode however. The reason is that address data is messy. Bits of it may be incomplete or incorrect and address cleansing software isn't 100% or even 90% reliable at sorting it out.

So for most purposes a postcode does not reliably determine the other bits of the address even though it is supposed to do so. Therefore it is no violation of Boyce Codd Normal Form (the NF that deals with functional dependency) to have postcode and the rest of the address in a single address table.
Reply With Quote
  #5 (permalink)  
Old 06-24-09, 10:17
blindman blindman is offline
World Class Flame Warrior
 
Join Date: Jun 2003
Location: Ohio
Posts: 11,726
Buy a different book.
__________________
If it's not practically useful, then it's practically useless.

blindman
www.chess.com: "sqlblindman"
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