basic geographic structure

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
DFS [ Mi, 20 September 2006 15:09 ] [ ID #1472493 ]

Re: basic geographic structure

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
torpecool [ Do, 21 September 2006 21:37 ] [ ID #1473794 ]
Datenbanken » mailing.database.mysql » basic geographic structure

Vorheriges Thema: Exporting accented characters
Nächstes Thema: Development Project