Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: How to find the rows that are different between a table and it's sub view.
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