Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: New-Bie SQL Question...
In article <6isqc6$7fv$1_at_engnews2.Eng.Sun.COM>, gosar_at_EBB.Eng.Sun.COM wrote:
>Hi,
>
>I have 2 tables (similar with 10 fields each...)
>each one has around 500K Rows with the second one
>having 100 Rows extra....
>
>How do I find the 100 Rows which are extra in the 2nd table
>using one SQL...??
>
>TIA,
>Bg
Is there a unique key that is common between the two tables? If so, you
can use an outer join and a where clause to target the "holes".
SELECT a_key from a, b WHERE a_key = b_key (+) AND b_key IS NULL ; This works where a is the larger table.
Another option is the "minus" operator. IE
SELECT * from A
MINUS SELECT * from B
The performance will vary depending on indexes that may or may not be present.
HTH
James
-- lorenzen_at_tiny.net | Life is complex; it has | real and imaginary partsReceived on Fri May 08 1998 - 00:00:00 CDT
![]() |
![]() |