Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: How to find the rows that are different between a table and it's sub view.

Re: How to find the rows that are different between a table and it's sub view.

From: Nis Jørgensen <nis_at_superlativ.dk>
Date: Tue, 12 Jun 2007 23:44:25 +0200
Message-ID: <466F13B9.10704@superlativ.dk>


Charles Hooper skrev:

> For instance, if the original SQL statement looked like
> this:
> SELECT
> IP,
> PORT
> FROM
> TABLE_A
> UNION ALL
> SELECT
> IP,
> PORT
> FROM
> TABLE_B;
>
> The above finds all rows in common between the two tables (one table
> and one view actually).

No it doesn't. For that you would use "INTERSECT", not "UNION ALL". Furthermore, I am as surprised as the other responder that you think a view is significantly slower than the SQL from the view definition.

I could see how

SELECT * FROM A
MINUS
SELECT * FROM A WHERE P would be slower in some cases than

SELECT * FROM A
WHERE NOT P though.

Pop quiz: In which cases do these two queries give different results?

/Nis Received on Tue Jun 12 2007 - 16:44:25 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US