Unix Technical Forum

Alias "all fields"?

This is a discussion on Alias "all fields"? within the Pgsql General forums, part of the PostgreSQL category; --> Hmm > SELECT * FROM gdp WHERE y1970 NOT NULL AND y1971 NOT NULL > AND .... y2005 NOT ...


Go Back   Unix Technical Forum > Database Server Software > PostgreSQL > Pgsql General

Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 04-09-2008, 07:22 PM
Franz.Rasper@izb.de
 
Posts: n/a
Default Alias "all fields"?

Hmm

> 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

Greetings,

-Franz

-----Ursprüngliche Nachricht-----
Von: pgsql-general-owner@postgresql.org
[mailtogsql-general-owner@postgresql.org] Im Auftrag von Stefan Schwarzer
Gesendet: Donnerstag, 6. September 2007 13:43
An: pgsql-general@postgresql.org
Betreff: [SPAM] [GENERAL] Alias "all fields"?


Hi there,

I guess I am demanding too much.... But it would be cool to have some
kind of alias for "all fields".

What I mean is this here:

Instead of this:

SELECT * FROM gdp WHERE y1970 NOT NULL AND y1971 NOT NULL
AND .... y2005 NOT NULL

I would like to have this:

SELECT * FROM gdp WHERE all-fields NOT NULL

This is, because my tables have different - and a different number of
fields.

In principal, I actually just want to have the number of fields which
are NOT NULL...

Thanks for any advice.

Stef


---------------------------(end of broadcast)---------------------------
TIP 4: Have you searched our list archives?

http://archives.postgresql.org/

---------------------------(end of broadcast)---------------------------
TIP 5: don't forget to increase your free space map settings

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 04-09-2008, 07:22 PM
Stefan Schwarzer
 
Posts: n/a
Default Re: Alias "all fields"?


>> 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?

>
> Greetings,
>
> -Franz
>
> -----Ursprüngliche Nachricht-----
> Von: pgsql-general-owner@postgresql.org
> [mailtogsql-general-owner@postgresql.org] Im Auftrag von Stefan
> Schwarzer
> Gesendet: Donnerstag, 6. September 2007 13:43
> An: pgsql-general@postgresql.org
> Betreff: [SPAM] [GENERAL] Alias "all fields"?
>
>
> Hi there,
>
> I guess I am demanding too much.... But it would be cool to have some
> kind of alias for "all fields".
>
> What I mean is this here:
>
> Instead of this:
>
> SELECT * FROM gdp WHERE y1970 NOT NULL AND y1971 NOT NULL
> AND .... y2005 NOT NULL
>
> I would like to have this:
>
> SELECT * FROM gdp WHERE all-fields NOT NULL
>
> This is, because my tables have different - and a different number of
> fields.
>
> In principal, I actually just want to have the number of fields which
> are NOT NULL...
>
> Thanks for any advice.
>
> Stef
>
>
> ---------------------------(end of
> broadcast)---------------------------
> TIP 4: Have you searched our list archives?
>
> http://archives.postgresql.org/
>
> ---------------------------(end of
> broadcast)---------------------------
> TIP 5: don't forget to increase your free space map settings



---------------------------(end of broadcast)---------------------------
TIP 1: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to majordomo@postgresql.org so that your
message can get through to the mailing list cleanly

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 05:34 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com