2

I have a table:

Person with columns:

pID(PK)
FName
LName
plID(FK)

Another table Place with:

plID(PK)
plCity
plState
plZip

Is it better to just have Person made like:

pID(PK)
FName
LName
City
State
Zip

For instance:

John Doe New York, NY 00000
Jane Doe New York, NY 00000
Jim Doe New York, NY 00000
Steven T. Snyder
  • 5,847
  • 4
  • 27
  • 58
CodeTalk
  • 3,571
  • 16
  • 57
  • 92

1 Answers1

5

You should normalize a database to eliminate data redundancy. In your case, it is very likely that you'll have a lot of people from the same place, which would cause data redundancy.

Therefore the answer is yes. You should absolutely normalize your database. You could possibly just include the zip code in the Person table and let that be a foreign key in Person and primary key in Place.

kba
  • 19,333
  • 5
  • 62
  • 89
  • I agree. The only gotcha is to ensure that when John Doe moves to San Francisco, CA 99999, it is only he that moves and not everyone else who was in New York, NY, 00000. – Jonathan Leffler Mar 20 '12 at 02:01
  • @JonathanLeffler Using my proposed design, you would just change the zip code in the `Person` table to 99999. Naturally, `Place` should not be touched. – kba Mar 20 '12 at 02:03
  • Well, I forgot to include, this table has a PersonID(PK) instead, so it would simply update where this PersonID = whatevernyzipwas to the new zip... in psuedo-sql :) – CodeTalk Mar 20 '12 at 02:06