Originally posted by jeff mutonho:
" Customer c " introduces the condition that the results will depend on the existence of "one or more records in the Customers Table"
I'm objecting to the book presenting it as a
special case. In SQL it is understood that if you don't specify a join condition the result will be the
cartesian product of the (two, three, four,...) tables - which means every row "will be joined" with every other row. So if any one table contains zero rows - the result has no rows - big surprise. :roll:
The passage in the book (in this context) is silent on the fact that
will produce a cartesian product (see EJB Spec 11.3.5 p.238). Example: If there are 3 orders and 5 customers, that query will present each of the three orders to you
five times.
Once you understand that it produces a cartesian product the behaviour they are pointing out is no longer "surprising". Instead they make it look like a special case just to avoid having to explain what a cartesian product is.
With
you indicate that you wish to use the defined CMR between customer and order "as join condition", i.e.:
[ November 02, 2005: Message edited by: Peer Reynders ]