From: | Tino Wildenhain <tino(at)wildenhain(dot)de> |
---|---|
To: | Stefan Schwarzer <stefan(dot)schwarzer(at)grid(dot)unep(dot)ch> |
Cc: | Franz(dot)Rasper(at)izb(dot)de, pgsql-general(at)postgresql(dot)org |
Subject: | Re: Alias "all fields"? |
Date: | 2007-09-06 12:51:54 |
Message-ID: | 46DFF7EA.8040601@wildenhain.de |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Stefan Schwarzer schrieb:
>
>>> SELECT * FROM gdp WHERE y1970 NOT NULL AND y1971 NOT NULL
>>> AND .... y2005 NOT NULL
>>
>> It sounds like a bad table design,
>> because i think you need an field "f_year" and "value_of_f_year" then
>> there would be entries like
>> f_year;value_of_f_year
>> 1970 'NULL'
>> 1970 dfgsd
>> 1971 'NULL'
>> 1971 ....
>>
>> where f_year IS NOT NULL and value_of_f_year IS NOT NULL
>
> My table design is - due to some import/update reasons - surely not the
> best one, but pretty simple:
>
> id y1970 y1971 y1972 ......
> 1 23 25 28
> 2 NULL NULL 5
> 3 NULL 94 102
>
> What do you think?
Make the table:
id | year | value
---+------+------
1 | 1970 | 23
1 | 1971 | 25
1 | 1972 | 28
...
2 | 1972 | 5
3 | 1971 | 94
3 | 1972 | 102
primary key: (id,year)
value not null
and be ready.
the import/update reasons are pretty easily solved
that way too.
Regards
Tino
From | Date | Subject | |
---|---|---|---|
Next Message | Alvaro Herrera | 2007-09-06 12:57:43 | Re: Controlling locale and impact on LIKE statements |
Previous Message | Alban Hertroys | 2007-09-06 12:51:51 | ANY (was: Re: Alias "all fields"?) |