How to verify if two tables have exactly the same data?
Posted
by SiLent SoNG
on Stack Overflow
See other posts from Stack Overflow
or by SiLent SoNG
Published on 2010-01-25T01:37:09Z
Indexed on
2010/04/30
10:17 UTC
Read the original article
Hit count: 204
Basically we have one table (original table
) and it is backed up into another table (backup table
); thus the two tables have exactly the same schema.
At the beginning both tables (original table
and backup table
) contains exactly the same set of data. After sometime for some reason I need to verify whether dataset in the original table
has changed or not.
In order to do this I have to compare the dataset in the original table
against the backup table
.
Let's say the original table
has the following schema:
`create table LemmasMapping (
lemma1 int,
lemma2 int,
index ix_lemma1 using btree (lemma1),
index ix_lemma2 using btree (lemma2)
)`
How could I achieve the dataset comparision?
Update
: the table does not have a primary key. It simply stores mappings between two ids.
© Stack Overflow or respective owner