0

I'm working on a ERD with mysql workbench, and i have a little question.

I have a Database with this tables:

  1. company_address
  2. country
  3. state
  4. city

I want to store the address of the company with all the data (country, state, and cuty). The relation between thos tables are:

 - country
   - id
   - name

- state
  - country_id
  - name

- city
  - state_id
  - name

My question is, what is better, put te relation of the company_addres just with the city?.

- company_address
  - city_id
  - company_name
  - more_fieds

Or put all FK of the location tables?

- company_address
  - city_id
  - state_id
  - country_id
  - company_name
  - more_fields

Wich one is the better way?. Or wich one will slow down the performance. Thanks!

  • What if there were a city that is in two states? Is "Kansas City" one city or two cities? – Walter Mitty Dec 19 '14 at 11:11
0

According to database normalization technique create a separate for city, state and country. However if you're having only few records in company address table and there is no other tables are need address info, I think there is no point creating multiple tables.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.