Re: Calculation of per Capita on-the-fly - problems with SQL syntax

From: Stefan Schwarzer <stefan(dot)schwarzer(at)grid(dot)unep(dot)ch>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Calculation of per Capita on-the-fly - problems with SQL syntax
Date: 2007-10-16 13:09:35
Message-ID: 0EFAED2F-5AA4-4016-856F-4B56E6DDE138@grid.unep.ch
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

> I suggest using two *date* (or possibly integer) columns for each
> row and consider each row an year interval (in the mathematical
> sense, not to be confused with SQL intervals, which are actually
> durations). Depending on the interval representation you choose
> (closed-open or closed-closed), a single-year interval (say, 1970),
> would be represented as either ('1970-01-01', '1970-01-01') or
> ('1970-01-01', '1971-01-01').

While trying to move step by step into the "right" direction, I
discover at every second step some "riddles" I have to solve...
Although not so much in favor of using two columns for the year
(start, end), I did it - only to discover that I have a couple of
variables that don't have a "numerical" year (such as 1970, or even
1970-75), but a textual called "various". "Various" means that there
is no common year for all countries for the retrieval/assessment of
the given value. That is, for one country it can be 1990, for another
1992, for a third 1995. As the actual year is not important (and not
always defined), one tries to use this kind of common describer:
various.

Evidently, it doesn't work with any of the envisaged or proposed
table layouts.

Does anyone have a nice solution to this problem? Thanks for any ideas!

Yours (slightly frustrated),

Stef

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Michael Glaesemann 2007-10-16 13:20:48 Re: Calculation of per Capita on-the-fly - problems with SQL syntax
Previous Message Farhan Mughal 2007-10-16 12:57:27 Architecture diagram!