There is simply no answer to this question. Even if your table structure does not change, queries may receive different execution paths over time, depending on the amount of data, indexes, restrictions, due to the hanging variable binding and other factors. Entire books have been written on this subject.
Cagcowboy's answer is incorrect. Oracle rewrites your query to ensure what it considers the best execution plan. Queries like the ones you describe often translate into sub-query blur . I assume that 9 times out of 10, requests similar to the ones you describe will have the same execution plan.
In my opinion, start with what is most readable, what will be clear to someone else reading your code (or yourself, after reading it in six months), what are your intentions. If your request is unacceptably slow, try optimizing it.
As Branko Dimitrievich points out, two questions that you think are the same are often not equivalent. In your two examples, if salesman_name is not unique, your first query will throw an exception ORA-01427: single-row subquery returns more than one row , but your second example will work fine.
source share