Re: Handling many one-to-many relationships
Posted by: Peter Brawley
Date: December 14, 2007 12:03PM

Simon,

Joins look intimidating till you've written a few dozen. It'll help to work through a few join tutorials.

And there are many reasons why explicit join syntax ...

SELECT ...
FROM t1
JOIN t2 ON t1.id=t2.t1id
JOIN t3 ON t2.id=t3.t2id
JOIN t4 ON t3.id=t4.t3id
WHERE ...

is to be preferred over the comma join syntax suggested by FJ:
it is easier to understand,
it is easier to maintain,
it succeeds where comma joins crash (see the manual page for joins),
it logically separates restrictions (Where clause) from virtual tables (Joins),
it easily distinguishes outer (eg left) and inner joins
it simplifies replacing unbearably slow Where [Not] Exists subqueries with an exclusion join.

PB

Options: ReplyQuote


Subject
Written By
Posted
Re: Handling many one-to-many relationships
December 14, 2007 12:03PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.