• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Tim Cooke
  • Devaka Cooray
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
Bartenders:
  • Carey Brown
  • Roland Mueller

Select ... from ...

 
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If select x from X x, Y y
The comma in the "from" clause is equivalent to an Inner Join or a pure Cartesian join?

In ETS test 5 Q.62:
Consider the following JPQL:

select c from Customer c, IN(c.orders) o

What will this query return?


The correct answer is :
All Customers who have at least one Order.

Because the query is translated into
"For Sun Java Application Server and MySQL, select c from Customer c, IN(c.orders) o actually gets translated to :
SELECT DISTINCT t0.ID, t0.LASTNAME FROM CUSTOMER t0, ORDER t1 WHERE (t1.CUSTOMER_ID = t0.ID)
"

But in EJB in action, the book says one can perform theta join using ',' in the "from" clause.

I am totally confused.
 
Ranch Hand
Posts: 413
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I think the book does not say that...

See this example

SELECT i
FROM Item i, Category c
WHERE i.star = c.rating

the relationship has been made using where not by ','

Anyway enthus answer is correct according to experience and spec.
 
I got this tall by not having enough crisco in my diet as a kid. This ad looks like it had plenty of shortening:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic