modeling question: abstract tables?

From: tom <tom_at_e.n.l.u.n.a.com>
Date: Wed, 9 Jul 2003 12:53:50 -0600
Message-ID: <vgop5umnqpfq1a_at_corp.supernews.com>



Hi,

    I'm currently modeling a db where my data is essentially a list of countries, and one of the tables related to the country is information about it's leader. The problem I have is that each country will have different fields for their leader, for example:

USA
-president
-vice president
-Environment Protection Agency Administrator

CANADA
-prime minister
-Minister of Foreign Affairs
-Environment Minister

UK
-head of state
-head of government
-environment minister

...and so forth...

So my question is how should I model this? I suppose the easiest way would be to have a separate table for each country, but I think this would be quite sloppy. Another way I thought would be to have a table called "leader" which simply contains <name,value> pairs, so have something like:

leaders



-leaderid (PK)

leaderinfo



-leaderinfoid (PK)
-leaderid (FK)
-name
-value

And then the user could add whatever fields he wanted .... That's all I can think of for now.... Any suggestions?

Thanks,

-Tom
Received on Wed Jul 09 2003 - 20:53:50 CEST

Original text of this message