Download rows that do not exist in the following tables.

Hello

I need to implement certain points of view in order to compare the systems.
This view will compare the tables with the same structure and I need to extract lines that do not exist in one of the sides.
I need to implement some points of view to not compare only two tables, others to compare the 3 tables and compare the 5 tables and another to compare the 10 tables!
Each table can contains a few lines to a maximum of 10 million rows (it was the highest number that I found for this tables).

My test scenario:
CREATE TABLE TEST_TABLE
(COL1 NUMBER ,
COL2 CHAR(25));

CREATE TABLE TEST_TABLE2
(COL1 NUMBER ,
COL2 CHAR(25));

CREATE TABLE TEST_TABLE3
(COL1 NUMBER ,
COL2 CHAR(25));


insert into TEST_TABLE (COL1,COL2) values (1,'2');
insert into TEST_TABLE (COL1,COL2) values (11,'t1');
insert into TEST_TABLE2 (COL1,COL2)  values (1,'2');
insert into TEST_TABLE2 (COL1,COL2) values (22,'t2');
insert into TEST_TABLE3 (COL1,COL2) values (1,'2');
insert into TEST_TABLE3 (COL1,COL2) values (33,'t3');
To find the differences between two tables, I've implemented the following:
select * from
(
(select * from TEST_TABLE
minus
select * from TEST_TABLE2
)
union all
(select * from TEST_TABLE2
minus
select * from TEST_TABLE
)
)

Result:
COL1 COL2
11     t1                       
22     t2                       
For the comparison of 3 tables, the result should be:
Result:
COL1 COL2
11     t1                       
22     t2                       
33     t3                       
For others, I can implement the same way, but for sure, this isn't the prettiest and best performing solution!

How can I get the result I'm going with the more performance?

Thank you
Ricardo Tomas

You did not say if you allow duplicates in your tables, so I assumed that you do not have.

If a single table may have multiple occurrences of a given col1, col2 combination you will need to separate the col1, col2 list each table before making the union of all.

ME_XE?  select
  2     col1, col2
  3  from
  4  (
  5     select col1, col2       from test_table
  6             union all
  7     select col1, col2       from test_table2
  8             union all
  9     select col1, col2       from test_table3
 10  )
 11  group by
 12     col1, col2
 13  having count(*) = 1;

              COL1 COL2
------------------ --------------------------------------
                33 t3
                22 t2
                11 t1

3 rows selected.

Elapsed: 00:00:00.01
ME_XE?

Tags: Database

Similar Questions

  • How to disable the AppStore offers updated app that does not exist on the ipod touch 5g ios 9 and Reset counter app

    Regularly I receive notifications of updated Brainiacs Sudoku which I had deleted Ipod Touch 5 g a long time ago.  I can't disable the app update counter until I have download the update.  So, how to disable the AppStore offers updated app that does not exist on the ipod touch 5g ios 9 and Reset counter of the application once and for all?

    Try to hide this purchase

    Hide and show purchases iTunes or iBooks on your Mac or PC - Apple Support

  • ORA-14030: partitioning column does not exist in the CREATE TABLE statement

    Hi all

    We are trying to create a partition materialized view and get an error below.
    ORA-14030: partitioning column does not exist in the CREATE TABLE statement
    Our GL_BALANCES21 and GL_CODE_COMBINATIONS21 base tables is already divided by interval of the range on Code_combination_id.
    In the same way that we try to partition the view materialized
    We get the error.
    ORA-14030: partitioning column does not exist in the CREATE TABLE statement
    Where the clause there are 4 tables gl_balances21, gl_code_combinations21, gl_periods and gl_set_of_books.


    CREATE MATERIALIZED VIEW apps. BAL_PART
    PARTITION BY RANGE ("CODE_COMBINATION_ID")
    (SCORE LOWER (80000) VALUES,
    PARTITION OF LOWER VALUES (160000),
    PARTITION OF LOWER VALUES (240000),
    PARTITION OF LOWER VALUES (320000),
    PARTITION OF LOWER VALUES (400000),
    PARTITION OF LOWER VALUES (480000),
    PARTITION OF LOWER VALUES (560000),
    PARTITION OF LOWER VALUES (640000),
    PARTITION OF LOWER VALUES (720000),
    PARTITION OF VALUES LESS THAN (800000),
    PARTITION OF LOWER VALUES (880000),
    PARTITION OF LOWER VALUES (960000),
    PARTITION OF VALUES LESS THAN (10400000),
    PARTITION OF LOWER VALUES (11200000),
    PARTITION OF LOWER VALUES (12000000),
    PARTITION OF LOWER VALUES (12800000),
    PARTITION OF VALUES LESS THAN (13600000),
    PARTITION OF LOWER VALUES (14400000),
    PARTITION OF VALUES LESS THAN (15200000),
    PARTITION OF LOWER VALUES (16000000),
    PARTITION OF VALUES LESS THAN (16800000),
    PARTITION OF VALUES LESS THAN (17600000),
    PARTITION OF VALUES LESS THAN (18400000),
    PARTITION OF VALUES LESS THAN (19200000),
    PARTITION OF LOWER VALUES (20000000),
    PARTITION OF VALUES LESS THAN (20800000),
    PARTITION OF VALUES LESS THAN (21600000),
    PARTITION OF VALUES LESS THAN (22400000),
    PARTITION OF VALUES LESS THAN (23200000),
    PARTITION OF LOWER VALUES (24000000),
    PARTITION OF VALUES LESS THAN (24800000),
    PARTITION OF VALUES LESS THAN (25600000),
    PARTITION OF VALUES LESS THAN (26400000),
    PARTITION OF LOWER VALUES (27200000),
    PARTITION OF LOWER VALUES (28000000),
    PARTITION OF VALUES LESS THAN (28800000),
    PARTITION OF VALUES LESS THAN (29600000),
    PARTITION OF VALUES LESS THAN (30400000),
    PARTITION VALUES LESS THAN (MAXVALUE))
    QUICKLY REFRESH ON DEMAND
    SELECT the QUERY REWRITE as
    SELECT GL.GL_CODE_COMBINATIONS21. ROWID C1,
    GL.GL_BALANCES21. ROWID C2,
    "GL". "" GL_BALANCES21 ". "" ACTUAL_FLAG, "
    "GL". "" GL_BALANCES21 ". "" CURRENCY_CODE "
    "GL". "" GL_BALANCES21 ". "" PERIOD_NUM, "
    "GL". "" GL_BALANCES21 ". "" PERIOD_YEAR ".
    "GL". "" GL_BALANCES21 ". "" SET_OF_BOOKS_ID ""SOB_ID"
    "GL". "" GL_CODE_COMBINATIONS21 ". "" CODE_COMBINATION_ID ""CCID.
    "GL". "" GL_CODE_COMBINATIONS21 ". "" SEGMENT1 ",.
    "GL". "" GL_CODE_COMBINATIONS21 ". "" SEGMENT10, "
    "GL". "" GL_CODE_COMBINATIONS21 ". "" DIRECTION11, "
    "GL". "" GL_CODE_COMBINATIONS21 ". "" SEGMENT12, "
    "GL". "" GL_CODE_COMBINATIONS21 ". "" SEGMENT13, "
    "GL". "" GL_CODE_COMBINATIONS21 ". "" SEGMENT14, "
    "GL". "" GL_CODE_COMBINATIONS21 ". "" SEGMENT2 ",.
    "GL". "" GL_CODE_COMBINATIONS21 ". "" SEGMENT3. "
    "GL". "" GL_CODE_COMBINATIONS21 ". "" SEGMENT4, "
    "GL". "" GL_CODE_COMBINATIONS21 ". "" SEGMENT5, "
    "GL". "" GL_CODE_COMBINATIONS21 ". "" SEGMENT6, "
    "GL". "" GL_CODE_COMBINATIONS21 ". "" SEGMENT7. "
    "GL". "" GL_CODE_COMBINATIONS21 ". "" SEGMENT8, "
    "GL". "" GL_CODE_COMBINATIONS21 ". "" SEGMENT9, "
    "GL". "" "" GL_PERIODS '. "" PERIOD_NAME,"
    NVL ("GL". "GL_BALANCES21" "." " (BEGIN_BALANCE_CR', 0) Open_Bal_Cr,
    NVL ("GL". "GL_BALANCES21" "." " (BEGIN_BALANCE_CR', 0) +.
    NVL ("GL". "GL_BALANCES21" "." " (PERIOD_NET_CR', 0) Close_Bal_Cr,
    NVL ("GL". "GL_BALANCES21" "." " (BEGIN_BALANCE_DR', 0) Open_Bal_Dr,
    NVL ("GL". "GL_BALANCES21" "." " (BEGIN_BALANCE_DR', 0) +.
    NVL ("GL". "GL_BALANCES21" "." " (PERIOD_NET_DR', 0) Close_Bal_Dr,
    NVL ("GL". "GL_BALANCES21" "." " (BEGIN_BALANCE_DR', 0).
    NVL ("GL". "GL_BALANCES21" "." " (BEGIN_BALANCE_CR', 0) Open_Bal,
    NVL ("GL". "GL_BALANCES21" "." " (BEGIN_BALANCE_DR', 0).
    NVL ("GL". "GL_BALANCES21" "." " (BEGIN_BALANCE_CR', 0) +.
    NVL ("GL". "GL_BALANCES21" "." " (PERIOD_NET_DR', 0).
    NVL ("GL". "GL_BALANCES21" "." " (PERIOD_NET_CR', 0) Close_Bal,
    NVL ("GL". "GL_BALANCES21" "." " (PERIOD_NET_CR', 0) Period_Cr,
    NVL ("GL". "GL_BALANCES21" "." " (PERIOD_NET_DR', 0) Period_Dr
    OF GL.GL_CODE_COMBINATIONS21.
    GL.GL_BALANCES21,
    GL.GL_SETS_OF_BOOKS,
    GL.GL_PERIODS
    WHERE GL.GL_BALANCES21. CODE_COMBINATION_ID = GL.GL_CODE_COMBINATIONS21. CODE_COMBINATION_ID
    AND GL.GL_SETS_OF_BOOKS. SET_OF_BOOKS_ID = GL.GL_BALANCES21. SET_OF_BOOKS_ID
    AND GL.GL_PERIODS. PERIOD_NUM = GL.GL_BALANCES21. PERIOD_NUM
    AND GL.GL_PERIODS. PERIOD_YEAR = GL.GL_BALANCES21. PERIOD_YEAR
    AND GL.GL_PERIODS. PERIOD_TYPE = GL.GL_BALANCES21. PERIOD_TYPE
    AND GL.GL_PERIODS. PERIOD_NAME = GL.GL_BALANCES21. PERIOD_NAME
    AND GL.GL_PERIODS. PERIOD_SET_NAME = GL.GL_SETS_OF_BOOKS. PERIOD_SET_NAME
    and gl.GL_CODE_COMBINATIONS21.summary_flag! = « Y »

    ERROR on line 54:
    ORA-01013: user has requested the cancellation of the current operation

    I checked the metalink note saying that ensure that all columns in a partitioning column list are columns of
    the table being created.

    Partition is already there, on the column of code_combination_id of gl_balances21 and gl_code_combinations21.

    Please suggest.

    Thank you

    It's your mistake:

    PARTITION BY RANGE ("CODE_COMBINATION_ID") 
    

    but in your projection of column list, you have an alias he:

    "GL"."GL_CODE_COMBINATIONS21"."CODE_COMBINATION_ID" "CCID",
    

    You must use the alias as a partition key, not the name fom the secondary table column.
    --
    John Watson
    Oracle Certified Master s/n
    http://skillbuilders.com

  • Repeat the download of 1 email that does not exist on the webmail.

    Same email (marked in bulk since Mohammed Kahn contains a large zip file that has not been opened) guard download of webmail. It doesnot exists on webmail. Once it downloads the load stops to low and other mails still on the web. I've been using Yahoo chat and after working with it, they said that it is in Mozilla. I deleted the file popstate.dat, as has been recommended for a simular problem. It had no effect.

    surgery radical property may be in order.

    Move all mail in the folder currently another place (another folder) and then right-click and select compact. Totally, who will rebuild the store for this folder, and in the process of deletion and corruption. It can also remove a lot of mail in the folder, from the idea to move wherever you want to keep somewhere else.

  • Continuous backup of statement he jumped a file that does not exist on the drive is not meant to save.

    I run Backup and get an error report that it has ignored files. He pointed out that he jumped a particular file on a disc "S". I have deleated this specific case a wile ago. The backup is supposed to DO NOT backup disc "S" anyway. How can I backup me to stop trying to save a file that no longer exists that where there it resides on a drive that backup was supposed to ignore?

    Hi John,.

    Thanks for posting the query on the Microsoft community.

    It seems that you are facing problems while performing the backup. It would be great if you can answer the following questions:

    1 have had any changes made on the computer before the show?

    2. What is the full and exact error message?

    Follow these methods to solve the problem:

    Method 1:

    First of all, I suggest you to refer to the article and see if it helps:

    Set up or change automatic backup settings

    http://Windows.Microsoft.com/en-us/Windows7/set-up-or-change-automatic-backup-settings

    Method 2:

    See the article and check if that helps:

    0x8100002F error code and or error code 0 x 80070002 when you back up files in Windows 7

    http://support.Microsoft.com/kb/979281

    If you have additional questions on the computer, please ask your question about Windows and we will be happy to help you.

  • How can I access my computer in order to remove downloaded files that has not deleted using the control panel and the usual functions to delete?

    I recently received from remote assistance installed a new anti-virus program. During using the remote technician, I he observed several open windows because it deleted the files that were left by previous anti-virus programs on my computer.  These files prevent the download of the new program.  As I watched him navigate through my programs and files, I noticed that there are a lot of game files that have been deleted by using the functions of the control panel and uninstalling still in my computer.  The technician of 3-4 programs installed on my computer while he removed residual files of the antivirus and promptly removed from these programs when it was correctly installed my new anti-virus program.  I would really like to know how to access files or records what he did and then delete the game files that I thought were removed.  I downloaded at least 100 trial offers for sets of objects hidden over the years and you don't want no trace with my memory of the computer.  No help available out there?

    Hey,.

    You can follow this link to recover lost or deleted files:

    http://Windows.Microsoft.com/en-us/Windows-Vista/recover-lost-or-deleted-files

    also, look for the file/game:

    http://Windows.Microsoft.com/en-us/Windows-Vista/save-your-search-results

    Hopefully this should help you.

  • I have Vista and I can not download anything that is, not connected to the internet

    Everything I try to download, i.e. Pokerstars, pogo, update my Flash Player, they say all that I need to connect to the internet or no internet connectivity... Help... I tried to stop my firewall, allowing it to function properly.

    Thank you

    Hi robbonand3,

    Your problem could be with the flash player.  I suggest that you uninstall and reinstall flash.  Here is the link to help you with this.

    Manual of Flash Player Uninstaller
    http://download.Macromedia.com/pub/flashplayer/Current/uninstall_flash_player.exe
    Flash Player installer manual
    http://www.Macromedia.com/go/full_flashplayer_win_ie

    Thank you for using answers Forum. Please let us know how it works.

    Joseph
    Microsoft Answers Support Engineer
    Visit our Microsoft answers feedback Forum and let us know what you think.

  • Folder that does not exist on the desktop

    It is the first time I saw this problem in all my years of using all versions of Windows. I have a folder on my desktop. It is empty, so I tried to remove it and got a message saying: it cannot be deleted because it isn't here. I tried to rename it with the same result. I did a complete search in the register the name of this folder and it came negative.

    I opened the folder and was able to add a file to it. Then I searched my C drive for that file and is found, but the search does not find the file. So I can't delete, rename, move or copy this folder.  Anyone know how I can get this file on my desktop?

    Thanks for any help you can give me.

    Eileen

    You may have a problem due to the use of some not printable or other special characters.

    Open a command prompt, change to the directory where this folder is located, and type

    dir /x {Enter}

    That should show you the "short name" (i.e., 8 characters) for the folder.  Your file should show that

    ELITTL ~ 1

    Now, make an order of RD using the short name:

    RD ELITTL ~ 1 {Enter}

  • I get a message that indicates the component that you are trying to use is on a CD-ROM or other removable disk that do not exist insert the 'Sonic Update Manager' disk and click ok

    He reads at the top of the installer of windows message

    Hi gerardoram9160,

    1. When you receive the error message?

    2. did you of recent changes on the computer?

    3. do you have 'Sonic Update Manager', installed on the computer?

    If you get the error message when the uninstall or uninstall the program, see the Microsoft article and try the steps mentioned below.

    How to troubleshoot issues that may occur when you install, uninstall, or upgrade one program on a Windows computer

    http://support.Microsoft.com/kb/2438651

    I hope this helps!

    Halima S - Microsoft technical support.

    Visit our Microsoft answers feedback Forum and let us know what you think.

  • my laptop with 7, the other with vista does not, windows message told to go update that does not exist on the start menu. I'm locked out using my computers

    my laptop, 1 vote against and 7, the other with vista will not work.  I use norton 360.  message at startup said to go to microsoft update on the start menu.  There is no windows update in the start menu.  I'm locked out using my laptop.  Help, please

    For Vista, see http://windows.microsoft.com/en-us/windows-vista/How-can-I-tell-if-my-computer-is-up-to-date and http://windows.microsoft.com/en-us/windows-vista/Updating-your-computer

    For Win7, see http://windows.microsoft.com/en-us/windows7/How-can-I-tell-if-my-computer-is-up-to-date and http://windows.microsoft.com/en-us/windows7/Updating-your-computer

  • The Apple showing in the page settings of ICloud ID does not go and watch my old email address that does not exist as an Apple ID.

    ID showing in the page settings of ICloud Apple won't and watch my old email address that does not exist in the Apple continues to him I identification code is required to sign in this old apple ID, but when I try to reset the password of the site Web of Apple tells me that this 'old' email address is not a piece of identification If that makes sense. I tried to disconnect from ICloud, but always keep asking the password sign to find my Ipad.

    I know my good Apple ID and password and have checked the details on Apple's site that shows the Ipad on the list of devices.

    The Ipad will connect has WiFi and I took it at John Lewis today where I bought it and they think that the problem is being caused by this problem of ID.

    Another that take it to the Apple store, anyone have any suggestions please?

    Welcome to the Apple community.

    If you are unable to remember your password, security issues, do not have access to your address of rescue or are unable to reset your password for any reason, your only option is to contact the Support of Apple ID, to speak to an operator you should explain that your problem is related to your Apple ID This way you can be attributed to the assistance, even if you do not have an AppleCare plan.

    You will need to be patient with the process and to be ready to prove without doubt that the account belongs to you. Do not expect access to be restored immediately and if you are not the owner of the Apple ID saved to the device the account will not be reset.

  • Can I import an old profile and prevent deletion of old emails that no longer exist on the server?

    I removed all the emails from the server and archivated them locally. A few days later, I reinstalled my windows, but I forgot to save the profile Thunderbird.

    I have an old backup, but whenever I try to use it, it doesn't (of course) delete all emails that do not exist on the server. Is it possible to avoid this automated sync or remove before opening the profile?

    Looks like you are using an Imap account.
    If you just try to save emails residing in mbox files (mbox files don't have any extension)

    Make sure Thunderbird is closed before doing anything in the profile folder.
    If you are familiar with the profile folder, you can copy paste the mbox files (without extension) in the account of 'Local folders' which is located in the folder "mail".
    and then restart Thunderbird. the indexing file (.msf) will automatically be created.

    OR
    Try to import them using a tool in "local folders".
    ImportExportTool addon:

    How to install the addon:
    Download file as addon for desktop or downloads folder.

    In Thunderbird
    Tools > icon menu or modules > Modules

    • Click the gear icon and select "install the addon from file".
    • Find the downloaded as file and click 'open '.
    • You have to restart Thunderbird.

    Make a right click on the "Local Folders" folder or another folder in "Local folders"
    Choose "ImportExporttools" > "file Mbox import.
    Select "Import directly one or more mbox files" and click OK

    Find the folder of mbox files backup profile
    Select mbox files, and then click 'open '.
    It has to import the folder containing emails.

  • Satellite L300 - peripheral USB need drivers that does not exist

    Satellite L300 race Win Vista 32 bit, connection of new devices (for example the card reader USB Signalex), I ask for a device driver that does not exist on the computer or on the Web and should not be necessary.

    How to do this? My previous laptop under Vista did not ask this.

    Hi Greenman,

    Have you tried other USB devices such as a USB or disk external DRIVE with USB interface? Normally you n t need additional drivers for most USB devices except printers for example.

    More I recommend removing all the USB ports on the Device Manager and then restart the laptop.

  • WebHelp, view a topic that is not present in the table of contents

    Hello

    I'm working on RH8. I use multiple TOC and created a table of contents with only the first 4 chapters. After having generated the WebHelp by using that FAKE, even if I look for a subject that did not exist in the table of contents, I can see the help.

    Ideally, if the topic is not added to the table of contents, should not be displayed even if someone searches for it.

    Please help me with this.

    Looks like you expect the table of contents to control what is in the construction and it's not the way it works. It is simply the pointer on key issues, which may need to support the topics where you wouldn't wish that the user to start and that might clutter up the table of contents.

    What you see, it's the way it is supposed to work and how a HAT I've seen. The table of contents indicates what you want to highlight, the search finds all that is in the build.

    You can use exclude research in properties, introduced in RH8. In this way the subject is in the build-up but not searchable.

    If you don't want certain topics, use TCC to exclude.

    See www.grainge.org for creating tips and RoboHelp

  • The logged data is not loaded in the target table in cdc-compatible?

    Hello

    I tried with cdc-simple concept on single table.

    I had loaded, journaled table (only changed records) inserted in the simple target in cdc table. Its working fine.

    When I work on cdc-consistent and logged data are not loaded in the target table

    For this, I used the data model, it has 3 data stores. log the without option of data, its works very well.

    When I am trying to load tables logged in the target table in interface, its running fine.

    To do this, I chose "logged data only.

    Although I have not changed the records in the target table. target table is empty after the executed insterface.

    err1.png

    err4.png

    err2.png

    err3.png

    I chose the real option of insertion in ikm. But the logged data that is not inserted in the target table.

    Please help me.

    Thankin advacnce,

    A.Kavya.

    Hello

    You must EXPAND WINDOW and LOCK SUBSCRIBERS before consuming the CDC data:

    http://docs.Oracle.com/CD/E14571_01/integrate.1111/e12643/data_capture.htm#ODIDG283

    Subsequently, you unlock Subscriber and purge the log.

    Better to put a package to automate the whole thing.

Maybe you are looking for