This week's book giveaway is in the OCMJEA forum. We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line! See this thread for details.
IDOne has a one to many relationship to IDTwo and IDTwo has a one to many relationship to IDThree. Now I have to fetch and present in a tabular format, all the IDOne and the associated IDTwo and IDThree. I was thinking to get this done as a subquery. Any alternative suggestions?
SCJP 1.4, SCWCD 1.4 - Hints for you, Certified Scrum Master
Did a rm -R / to find out that I lost my entire Linux installation!
Joe Harry wrote:Do you mean joins perform better than sub queries?
It eventually depends on the actual database you're using, but generally join is the most common operation databases would be expected to do, therefore databases should be good at doing joins. Join would be my first choice, I go for subquery only when it is easier to write the SQL statement that way. With three tables involved, it is probably not the case.
Moreover, Oracle can internally process subqueries as joins (and vice versa). You can always compare the generated plans and performance of the two approaches, if still in doubt.