我有两个表:
- 地址:
..., country, state, city ....
- 地点:
..., name, ancestry:
- 1: USA |
- 2: NY | 1
- 3: Wall Street | 2
- 4: Germany |
- 5: CA | 1
- 6: Berlin | 4
我是否应该在表地址中存储所有数据,例如国家,州,城市是否只有一个带有城市的字段就足够了?我应该根据城市寻找国家吗?
理想情况下,您应该为国家、州和城市提供单独的表格像这样:
Country : CountryId, CountryName
State : StateId, StateName, CountryId
City : CityId, CityName, StateId
然后,在Location
或Address
表中使用CityId
。