Re: how to do 'deep queries'? - Mailing list pgsql-sql

From Daryl Richter
Subject Re: how to do 'deep queries'?
Date
Msg-id 433947F6.7060106@brandywine.com
Whole thread Raw
In response to Re: how to do 'deep queries'?  ("Anthony Molinaro" <amolinaro@wgen.net>)
List pgsql-sql
Anthony Molinaro wrote:
> that query is 100% correct.
>  
> it's just an equijoin (a type of inner join) between 3 tables.
>  
> the syntax you show is how queries should be written and is more
> representative of what a joins between relations really are:
> Cartesian products with filters applied
>  
> the ansi syntax, the explicit JOIN ... ON  stuff is (imho) unnecessary,
> useful only for outer joins since all the vendors did it differently.
>

Whether you feel that is unnecessary or not, it *is* the ANSI Standard 
and is thus, by definition, "how queries should be written."

In addition to cleaning up the outer join issue, it was added to make 
the *intention* of the query clearer.

Because others are likely to read your query many more times than you 
write it, clarity of intent *is* important.

> what you have will work for postgreSQL, I used the syntax you show in my
> book
> for every single join recipe except for outjoins.
>  
> are you seeing errors?
>  
> regards,
>   Anthony

[original snipped]

-- 
Daryl

"We want great men who, when fortune frowns, will not be discouraged."    -- Colonel Henry Knox, 1776



pgsql-sql by date:

Previous
From: "Brandon Metcalf"
Date:
Subject: Re: add column if doesn't exist
Next
From: Daryl Richter
Date:
Subject: Re: Updating cidr column with network operator