How to Determine Equality of Two Very Large Tables
I'm using DB2 and I have two tables that have a million+ rows in them. Is there a query I can create that will check the two tables to see if all the values in the two are the same? Or, what is the best way to do this?
Th开发者_如何学Pythonanks, Tyler
Use:
SELECT *
FROM TABLE_A
INTERSECT
SELECT *
FROM TABLE_B
...assuming columns are identical. For more info on INTERSECT (and EXCEPT), see this article.
精彩评论