Re: Grammatical Inconsistencies
Date: Wed, 28 Apr 2004 12:32:39 +0100
Message-ID: <gBMjc.35613$h44.5277479_at_stones.force9.net>
Laconic2 wrote:
> SQL does not distinguish between join conditions and restriction conditions.
> SQL stuffs them all in the WHERE clause.
Maybe very old versions of SQL don't but most SQLs now do:
SELECT *
FROM A JOIN B
ON A.foo = B.bar
WHERE A.col = 5
This syntax makes LEFT and RIGHT JOINs easier to use as well instead of the old (*) syntax used by some DBMSs, and it removes some ambiguities.
Unless I'm misunderstanding what you mean.
Paul.
> There are other languages that don't do that. They might have a construct
> like:
>
> E IN EMPLOYEES JOIN D IN DEPARTMENTS OVER DEPARTMENT_ID
>
> This gets messy if the column names are different in the two tables.
>
> It can be good practice for SQL programmers to put all the join conditions
> ahead of the
> restirction conditions in the WHERE CLAUSE, as a matter of programming
> style. It makes desk
> checking easier.
>
> That of course, presumes that the optimizer won't be misled by the order in
> which predicates
> combined by AND OR and NOT are presented.
>
>
Received on Wed Apr 28 2004 - 13:32:39 CEST