Results 1 to 13 of 13
Oct 5, 2013, 08:05 #1
- Join Date
- Jul 2013
- South of the equator, then turn left
- 0 Post(s)
- 0 Thread(s)
Database normalization: city and country tables etc
I'm busy normalizing my database and have a few questions.
My city table has a city id, city name and country id
The country table has a country id, country name and continent id
The continent table has a continent id and a continent name
I'll maybe need to add a region table as well.
Now the city id, country id and continent id columns are used as foreign keys in a “restaurant” table. Is it necessary to include the country id column since it's already present (as a foreign key) in the city table? If it isn't necessary then how would I use it to access the country name in the country table? Similarly the continent id might not be necessary since it is present in the country table. Or doesn't it work that way?
I'm just asking because my restaurant table already has a number of foreign key columns and the more there are, the more confusing things become. Scanning across a row just shows fields containing numbers. Is this just the ways things are?
Thanks for your time!