Re: Column aliases in WHERE clauses

From: Mike Christensen <mike(at)kitchenpc(dot)com>
To: Eden Cardim <eden(at)insoli(dot)de>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Column aliases in WHERE clauses
Date: 2012-09-18 15:43:16
Message-ID: CABs1bs2mSBGEY96iweQF+HWdOb3D8xQi2KZz6AHh1Rd9VBv1og@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Tue, Sep 18, 2012 at 2:53 AM, Eden Cardim <eden(at)insoli(dot)de> wrote:
>>>>>> "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.

Oh no, this debate again..

I do admit LINQ kind of threw me for a loop as they took the other
approach (from f in foo where f.id > 5 select f), which makes you
think about the collection you're working with first. I usually think
about the table first when I'm writing a query.

I can also say if the table came before the columns, we'd probably
have a lot more SQL editors with auto-complete that worked :)

Mike

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Raymond O'Donnell 2012-09-18 15:51:24 Re: On Ubuntu 12.04 i do have two psql one of those isn't working
Previous Message Yvon Thoraval 2012-09-18 15:10:51 Re: On Ubuntu 12.04 i do have two psql one of those isn't working