basic geographic structure

basic geographic structure

am 20.09.2006 15:09:07 von DFS

Hello

I need help with the data model of a basic geographic structure
Country > State/Region > Sub-Region

Most of the countries have a 3 level, so i want to do this
_________
Country
contry_id
....
_________
Region
region_id
country_id
.....
__________
Sub-region
sub_region_id
region_id
_________
Client
client_id
sub_region_id

My Question:

Some countries do no have 3rd level (Sub-region) what is the best way to
manage this when normaly my Client table needs to be linked to the 3er
level data (sub_region_id)

Thank you, any tips will be appreciated

Dario

Re: basic geographic structure

am 21.09.2006 21:37:34 von torpecool

I don't know if this is the most efficient solution, but the regions
that don't have sub-regions, could just have 1 sub-region that all
clients reside in. In a way, the 1 sub-region would cover the entire
region.

So a regular case would be like this:
Region:
Sub1:
Client 1, Client 2, Client 3
Sub2:
Client 1, Client 2, Client 3
Sub3:
Client 1, Client 2, Client 3

A case where no sub-regions are necessary:
Region:
Sub1:
Client 1, Client 2, Client......

This was my first thought. I hope it helps.


Ruben wrote:
> Hello
>
> I need help with the data model of a basic geographic structure
> Country > State/Region > Sub-Region
>
> Most of the countries have a 3 level, so i want to do this
> _________
> Country
> contry_id
> ...
> _________
> Region
> region_id
> country_id
> ....
> __________
> Sub-region
> sub_region_id
> region_id
> _________
> Client
> client_id
> sub_region_id
>
> My Question:
>
> Some countries do no have 3rd level (Sub-region) what is the best way to
> manage this when normaly my Client table needs to be linked to the 3er
> level data (sub_region_id)
>
> Thank you, any tips will be appreciated
>
> Dario