oracle diff: how to compare two tables?

后端 未结 12 1972
忘了有多久
忘了有多久 2021-01-31 03:22

Suppose I have two tables, t1 and t2 which are identical in layout but which may contain different data.

What\'s the best way to diff these two tables?

12条回答
  •  难免孤独
    2021-01-31 04:04

    Try this:

    (select * from T1 minus select * from T2) -- all rows that are in T1 but not in T2
    union all
    (select * from T2 minus select * from T1)  -- all rows that are in T2 but not in T1
    ;
    

    No external tool. No performance issues with union all.

提交回复
热议问题