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

  • Home
  • SEARCH
  • 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 8927353
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T08:12:27+00:00 2026-06-15T08:12:27+00:00

I was going through the Learning SQL 2nd Edition book. Is there any difference

  • 0

I was going through the Learning SQL 2nd Edition book. Is there any difference between the SET operations and the JOIN.Are there any situations where you would go with SET operations leaving JOIN.

Correct me if i am wrong, we can do all the things using JOIN what we can do with SET.

  • 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-15T08:12:28+00:00Added an answer on June 15, 2026 at 8:12 am

    No, you cannot do all the things with a join that you can do with the set operations. However, if two tables have the same structure and have unique identifiers on each, then you can:

    A union would be:

    select driver.id,
           coalesce(t1.col1, t2.col1) as col1,
           . . .  -- repeat this for all columns
    from (select distinct coalesce(t1.id, t2.id) as id
          from ((select id
                 from t1
                ) full outer join
                (select id
                 from t2
                )
               )
         ) driver left outer join
         t1
         on t1.id = driver.id left outer join
         t2
         on t2.id = driver.id
    

    The except and intersect can be approached in the same way, but putting conditions on the full outer join in the driver table.

    In fact, you can extend this idea to not require a unique id, just assuming that the rows are unique in each table. In that case, the joins are more complicated, because you have to include all columns, and also take into account NULL values in the columns.

    That said, the set operations have several advantages:

    1. They are more readable. You and everyone else would probably agree that union and union all are much more readable than the above queries.
    2. The SQL engine understands the set operations, so they are typically going to be more efficient.
    3. It is easy to make a subtle error in the more complicated SQL statement that would radically change the results. For instance, changing the ‘full outer join’ in the driver table above into ‘inner join’ is the difference between union and intersect.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have been going through the book Learning WCF trying to get my head
I'm currently going through the book Learning Python The Hard Way, and I'm trying
I'm learning SQL alchemy and going through the Expression Language Tutorial . I really
After successfully going through the initial stages of learning C# in tandem with SQL
I m learning asp.net basics. i was going through tutorial at www.dotnetspider.com and there
I’m just really learning Java, going through tutorials in book Java how to Program
I am studying Python and currently going through some more learning with dictionaries. I
I'm going through the process of learning backbone and don't understand all of the
I'm just learning the Opa language and going through their Manual. In the third
While going through SWig generated wrappers, I find that the PInvokes don't have any

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.