Search Postgresql Archives

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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

---------------------------(end of broadcast)---------------------------
TIP 6: explain analyze is your friend

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux