Re: Database/Table Design for Global Country Statistics

From: Ron Johnson <ron(dot)l(dot)johnson(at)cox(dot)net>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Database/Table Design for Global Country Statistics
Date: 2007-09-12 09:28:31
Message-ID: 46E7B13F.7060608@cox.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 09/12/07 03:28, Stefan Schwarzer wrote:
[snip]
>
> The new design would be like this:
>
> id | year | value
> -------------------------------
> 1 | 1970 | NULL
> 1 | 1971 | 36
> 1 ....
> 1 | 2005 | 45
> 2 | 1970 | ....
> 2 .....
>
>
> Would that be considered as "good table design" then?

What Richard says, plus:

1. The PK of New_Design should be country_id/year.

2. You also should not store the records where "value is NULL". A
left outer join would handle that.

- --
Ron Johnson, Jr.
Jefferson LA USA

Give a man a fish, and he eats for a day.
Hit him with a fish, and he goes away for good!

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)

iD8DBQFG57E/S9HxQb37XmcRAsb/AJ97lFt25sLwIYhkhQgGdJq2m8NaXgCfTxIV
rVuX5FF0XRDkXJgdSlV1qZg=
=jyv3
-----END PGP SIGNATURE-----

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Stefan Schwarzer 2007-09-12 09:35:01 Re: Database/Table Design for Global Country Statistics
Previous Message Albe Laurenz 2007-09-12 09:19:54 Re: Question to schema public