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 1053385
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T17:14:42+00:00 2026-05-16T17:14:42+00:00

I have two tables with identical fields that share many rows. I’d like to

  • 0

I have two tables with identical fields that share many rows. I’d like to list all the rows in one table that cannot be matched in the other. Specifically, these two tables are two different versions of an experiment where the results differ slightly. An example is something like this:

|TableA|
--------
horse
cat
cow
table

|TableB|
--------
horse
cat
chair

I’d like to be able to see that TableA is missing chair from TableB and possibly in a different query that TableB is missing cow and table are missing from TableA.

My thought was to do some sort of outer join on all fields, then sort out the rows with nulls in them, but this seems heavy handed. Is this the way to go or is there are more elegant/efficient approach?

  • 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-05-16T17:14:43+00:00Added an answer on May 16, 2026 at 5:14 pm

    Using NOT IN:

    SELECT a.column
      FROM TABLE_A a
     WHERE a.column NOT IN (SELECT b.column
                              FROM TABLE_B b)
    

    Using NOT EXISTS:

    This is a good one if you need to compare more than one column…

    SELECT a.column
      FROM TABLE_A a
     WHERE NOT EXISTS(SELECT NULL
                        FROM TABLE_B b
                       WHERE b.column = a.column)
    

    Using LEFT JOIN/IS NULL:

       SELECT a.column
         FROM TABLE_A a
    LEFT JOIN TABLE_B b ON b.column = a.column
        WHERE b.column IS NULL
    

    Because of the table aliases, you could swap the table names without changing the rest of the query to see the opposite–rows from TABLE_B that aren’t in TABLE_A.

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

Sidebar

Related Questions

I have two tables that have identical columns. One table houses imported data, the
I have two identical tables, one with current values for rows, and one with
The following SQL generates all matching records between two tables that have identical schemas
I have two identical tables and need to copy rows from table to another.
I have two tables that have virtually identical content and very similar structure. They
I have two tables one with ID and NAME table 1 ID | NAME
I have two tables almost identical: employee employee_history The second table has two additional
I have two identical tables with the same number of rows but with different
I have two tables with identical fields, 35 identical fields. I know I can
I have two tables, 'photos' and 'videos'. Together they are almost identical, except one

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.