Re: Calculation of per Capita on-the-fly - problems with SQL syntax - Mailing list pgsql-general

From Stefan Schwarzer
Subject Re: Calculation of per Capita on-the-fly - problems with SQL syntax
Date
Msg-id 0EFAED2F-5AA4-4016-856F-4B56E6DDE138@grid.unep.ch
Whole thread Raw
In response to Re: Calculation of per Capita on-the-fly - problems with SQL syntax  (Michael Glaesemann <grzm@seespotcode.net>)
Responses Re: Calculation of per Capita on-the-fly - problems with SQL syntax
List 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

pgsql-general by date:

Previous
From: Farhan Mughal
Date:
Subject: Architecture diagram!
Next
From: Michael Glaesemann
Date:
Subject: Re: Calculation of per Capita on-the-fly - problems with SQL syntax