Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

Comparing the data in two tables in Oracle

Anyone have any idea how to compare the data in two tables and create a third with the differences?


Comments

  • First create the third table (ex: table3) with the same format as the two other tables (ex: table1 and table2) with the CREATE TABLE.....


    Then, make an "insert into table3" followed by your select criterias wich must look first for the union of the two tables without then the intersect of the two tables.


    example: INSERT INTO TABLE3 SELECT * FROM TABLE1 UNION SELECT * FROM TABLE2 MINUS (SELECT * FROM TABLE1 INTERSECT SELECT * FROM TABLE2);


    table1 = [abcd] table2=[defg]

    union = [abcdefg]

    intersect = [d]

    union MINUS intersect = [abcefg] => table3


    Hope this will help you...!!





Sign In or Register to comment.