I’ve seen people hypothetically say that there are cases when a subquery can be more efficient than a join but I have never actually seen a good example of this?
What would be a case when you would want to use a subquery over a join?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The classic example is searching for rows in a table that do not have corresponding rows in another.
is generally better than
See also: Left outer join vs NOT EXISTS