database - Data Logical organization -


i have 2 tables: counterparties , customers. , both have address field. don't know, better if create third table "addresses"?
the first way:

counterparty

  • id
  • name
  • city
  • streetname
  • room

customer

  • id
  • firstname
  • lastname
  • city
  • streetname
  • room



second way:

counterparty

  • id
  • name
  • addressid

customer

  • id
  • firstname
  • lastname
  • addressid

address

  • id
  • city
  • streetname
  • room

what better way?

the first solution better, unless either:

  1. you have customers counterparties (but should change whole schema design), or
  2. several customers and/or counterparties have same address (for instance in same building).

there no other reasons choose second solution.


Comments

Popular posts from this blog

How has firefox/gecko HTML+CSS rendering changed in version 38? -

javascript - Complex json ng-repeat -

jquery - Cloning of rows and columns from the old table into the new with colSpan and rowSpan -