开发者

How to configure all administrative levels in a DB schema

Administrative levels are common up to state for all countries and then the level varies interms of number based on the country.

eg: In US, its state->territory->county->city (4 levels) and in India, its state->city->village->taluk->panchayat (5 levels in this case)

how to gene开发者_JS百科ralize these levels in a DB schema considering each and every level in all countries?


The data is clearly telling you that India and the US have both a) a different number of attributes, and b) different attributes. In relational modeling, different attributes and different numbers of attributes signify different domains and different relations. Generalizing them, in the sense of designing one table to fit all countries, might not be a good idea. (Mixing multiple domains and relations into one usually leads to pain.)

According to the ISO, England, Scotland, Wales, and Northern Ireland are not countries. (They're said not to be countries in the political sense.) But when you're talking about administrative levels, they seem to be countries within Great Britain. (They seem to be countries in an administrative sense.)

Based on my experience in legal systems, I can guarantee one thing: China will break almost any generalized model. To cite one example, some cities are provinces. In the US, that's like saying New York City is a state. A fully generalized model practically guarantees you store nonsense like that for some (most?) countries. Whether you can tolerate that is application-specific.

But, having said all that, here's an example of how Google Maps approaches your problem.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜