Re: Outer join by (+)



Robert Klemme wrote:
On 02.01.2008 15:33, Brian Tkatch wrote:
On Sat, 29 Dec 2007 10:56:45 +0000, Adam Cameron
<adam_junk@xxxxxxxxxxx> wrote:

But when I use (+) syntax, it will be easy to design and understand.
Not if the person reviewing your code is more accustomed to ANSI-standard SQL than out-of-date Oracle peculiarities.

I can read the standard SQL just fine, because that's what I'm used to. I have to stop and think about the Oracle-specific stuff because I'm less familiar with it.

I presume it's the other way around for you for the reverse reasons.


I find the (+) is very intuitive. In describes the join in the WHERE
clause quite well. Basically, it means that that this join is a join
"plus". It just takes a moment to realize that is what it means.

The ANSI syntax, however, is downright confusing.

You should add a "for me" at the end of the sentence above. This is exactly what Adam's comment was all about: some prefer one and others prefer the other.

Further, i think it breaks the SQL paradigm. A FROM clause includes, a
WHERE clause excludes. Another TABLE in the FROM clause includes it,
saying it is not Cartesian, is an exclusion. Therefore, it belongs in
the WHERE clause.

What exactly is the "SQL paradigm"? I know only a SQL standard (or rather several versions of it) which defines certain semantics for particular syntactical constructs. As far as I can see JOIN's are properly defined within the standard and do not break anything (because it was a new construct when added).

Both situations hereare entirely reasonable, I think, but *looking forward*, sticking to standards-conforming SQL is probably the better approach.

IMO.

Good point. I would like to counter point.

A person looking forward to a maintenance coder who probably will
spend less time than required modifying a query, may have a harder
time figuring out where to put a new clause. That is, whether it goes
in the FROM clause or the WHERE clause, and how it affects to total
join, as nesting is a big issue. However, when all clauses are kept in
the WHERE clause, the maintenance coder knows exactly where it goes,
and, IMO, is more likely to do it correctly.

This still leaves the issue of lesser expressiveness for the proprietary Oracle syntax (see the link I posted earlier).

Kind regards

robert

The endless, and meaningless, debate about which is more intuitive or
which has the prettiest color, or whatever is amusing. Lets look at
reality.

SELECT *
FROM t1, t2
WHERE t1.col = t2.col;

replace the comma with the word JOIN
replace the word WHERE with the word ON
and you get

SELECT *
FROM t1 JOIN t2
ON t1.col = t2.col;

Lets see one byte becomes four so add 3
and five bytes become two so subtract 3

And for this people get excited?

No doubt with a RIGHT OUTER JOIN you can stave off carpal tunnel
syndrome for an additional 15 minutes by using (+) but is this
really worth all the keystrokes that go into this seemingly
endless discussion?
--
Daniel A. Morgan
Oracle Ace Director & Instructor
University of Washington
damorgan@xxxxxxxxxxxxxxxx (replace x with u to respond)
Puget Sound Oracle Users Group
www.psoug.org
.



Relevant Pages

  • Re: Locking question when using Select clause with For Update and Skip locked
    ... table for update and skipped the rows locked by other sessions on same ... select top 1 empno from emp ... (we also have order by clause but will remove it here for simplicity) ... Now on Oracle system it is ...
    (comp.databases.oracle.server)
  • Re: How top actually works
    ... So the next one shows that order by clause has affected the result set ... sort these N rows according to my order by clause. ... Ie. you are telling SQL Server ... This is much the same as with rownum in Oracle, ...
    (comp.databases.ms-sqlserver)
  • How top actually works
    ... I'm coming from Oracle world and trying to find something similar to ... So the next one shows that order by clause has affected the result set ... and actually semms to be pushed into inner query. ... the user just ANY N rows satisfying criteria. ...
    (comp.databases.ms-sqlserver)
  • Re: select on a view -> ORA-12571
    ... But if I use the field VID_SBA inside the where- clause I get an error ORA-12571 an the connection to DB is closed. ... Oracle Customer Support. ... If Oracle is installed second time and the error is up and away and I can't reproduce it my application will be delivered without any guarantee whether the problem is solved or not! ... Laurenz Albe ...
    (comp.databases.oracle.misc)
  • Re: Outer join by (+)
    ... Not if the person reviewing your code is more accustomed to ANSI-standard SQL than out-of-date Oracle peculiarities. ... I can read the standard SQL just fine, because that's what I'm used to. ... WHERE clause excludes. ... This still leaves the issue of lesser expressiveness for the proprietary Oracle syntax. ...
    (comp.databases.oracle.server)