Re: Grammatical Inconsistencies
Date: Wed, 28 Apr 2004 12:32:39 +0100
> 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:
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.
> There are other languages that don't do that. They might have a construct
> 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