Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

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.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8587479
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T22:34:45+00:00 2026-06-11T22:34:45+00:00

Please can anyone give me the difference between using a Correlated sub-query over a

  • 0

Please can anyone give me the difference between using a Correlated sub-query over a JOIN ? Are they not meant to solve the same problem. Is there a performance Hit over one. I am using SQL server and I tend to use FOR XML PATH(”) to select multiple columns that occur in subqueries. Any example to explain the difference will be appreciated.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T22:34:46+00:00Added an answer on June 11, 2026 at 10:34 pm

    “Please can anyone give me the difference between using a Correlated sub-query over a JOIN ? Are they not meant to solve the same problem ?”

    No they aren’t.

    With correlated subqueries, you get an expression for an invocation of either the SEMIJOIN or else the SEMIMINUS of the relational algebra. (Note that I’m talking here of the most typical use of correlated subqueries.)

    SELECT * FROM A1
     WHERE attr in (SELECT attr FROM A2);
    

    gives you only the columns that appear in A1. Unlike what you would get if you wrote the JOIN

    SELECT * FROM A1 NATURAL JOIN A2
    

    which would also give you any additional columns from A2 that do not appear in A1.

    And

    SELECT * FROM A1
     WHERE attr NOT IN (...)
    

    also involves a correlated subquery, but this time it is a semiminus invocation which cannot even be written as a JOIN.

    And finally, correlated subqueries can also appear in the SELECT list.

    SELECT a,b, ( SELECT MIN(b) FROM T AS sub WHERE sub.a=main.a AND sub.b>main.b )
      FROM T AS main
    

    In this case too, many queries of this nature cannot be written as a JOIN.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

It does not matter what programming language. Can anyone please give me an idea
Can anyone help me? I am not able to understand the difference between success
Can anyone please explain me what delegateEvents in backbone.js does? The documentation did not
Please can anyone give me links or code or concept for Running an activity
Can anyone please give me any example of situation in a database-driven application where
Can anyone give me some help with a design please? my users enter short
Can anyone please give me a nice, expert but concise summary the ASP.NET compilation
Can anyone give me a link to Oracle SQL grammar, please? By grammar, I
Can anyone give me a quick summary of the differences please? To my mind,
Can anyone please point me to a tutorial or article or give a solution

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.