title: How to verify if two tables have exactly the same data?
body: <p>Basically, we have one table (<code>original table</code>) and it is backed up into another table (<code>backup table</code>); thus the two tables have exactly the same schema. </p>
  
  <p>In the beginning, both tables (<code>original table</code> and <code>backup table</code>) contains exactly the same set of data. After some time for some reason, I need to verify whether dataset in the <code>original table</code> has changed or not.</p>
  
  <p>In order to do this, I have to compare the dataset in the <code>original table</code> against the <code>backup table</code>.</p>
  
  <p>Let's say the <code>original table</code> has the following schema:</p>
  
  <pre><code>create table LemmasMapping (
     lemma1 int,
     lemma2 int,
     index ix_lemma1 using btree (lemma1),
     index ix_lemma2 using btree (lemma2)
  )
  </code></pre>
  
  <p>How could I achieve the dataset comparison?</p>
  
  <p><strong>Update</strong>: the table does not have a primary key. It simply stores mappings between two ids. </p>