Comparing the data in two tables in Oracle - Programmers Heaven

Howdy, Stranger!

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

Categories

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.