Re: how to do 'deep queries'?

From: Daryl Richter <daryl(at)brandywine(dot)com>
To: pgsql-sql(at)postgresql(dot)org
Subject: Re: how to do 'deep queries'?
Date: 2005-09-27 13:24:06
Message-ID: 433947F6.7060106@brandywine.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Chris Browne 2005-09-27 13:34:07 Re: add column if doesn't exist
Previous Message Brandon Metcalf 2005-09-27 12:45:59 Re: add column if doesn't exist