Data Logical organization

52 views Asked by At

I have two tables: counterparties and customers. And both have an address field. I don't know, would it be better if I create third table "addresses"?
The first way:

Counterparty

  • id
  • name
  • city
  • streetname
  • room

Customer

  • id
  • firstName
  • lastName
  • city
  • streetname
  • room



The second way:

Counterparty

  • id
  • name
  • addressID

Customer

  • id
  • firstName
  • lastName
  • addressID

Address

  • id
  • city
  • streetname
  • room

What is better way?

1

There are 1 answers

0
Renzo On

The first solution is better, unless either:

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

There are no other reasons to choose the second solution.