Column aliases in WHERE clauses

From: Eden Cardim <eden(at)insoli(dot)de>
To: pgsql-general(at)postgresql(dot)org
Subject: Column aliases in WHERE clauses
Date: 2012-09-18 09:53:15
Message-ID: m2y5k7u06s.fsf_-_@insoli.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

>>>>> "Craig" == Craig Ringer <ringerc(at)ringerc(dot)id(dot)au> writes:

Craig> I just wish they hadn't written it backwards!

Craig> It'd be much less confusing were it formulated as something
Craig> like:

Craig> SELECT FROM thetable WHERE first_letter > 'a' RESULTS
Craig> left(value,1) AS first_letter

Craig> or something, where the order is more obvious. I really
Craig> dislike the way SQL is written not-quite-backwards.

It's not "written backwards", it's plain natural language semantics:
"give me the first letter of all records where the first letter is
greater than a". Refining a set is better done walking from the more
general set to a subset, not the other way around, IMO: "give me all
persons that are females and over the age of 20". Mathematical set
builder notation does this in a similar fashion, for the same reason.

--
Eden Cardim
http://insoli.de

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Виктор Егоров 2012-09-18 10:03:35 Re: Data recovery after inadvertent update?
Previous Message Chris Travers 2012-09-18 09:34:59 Re: foreign key from array element