title: Compare two tables in SQLite
body: <p>I have two tables in the database <code>MyTable</code> and <code>MyTableChanges</code>. I want to detect changes (which records were inserted/removed from <code>MyTableChanges</code> or edited).</p>
  
  <p>Is it possible? I would like to do this using only <code>SQLite</code> queries.</p>
  
  <p>I know I can use 2 queries like the one below to detect inserted and removed rows:</p>
  
  <pre><code>SELECT DISTINCT SomePrimaryKey
  FROM MyTable
  WHERE SomePrimaryKey Not IN 
      (SELECT DISTINCT SomePrimaryKey FROM MyTableChanges)
  </code></pre>
  
  <p>But how to compare changes? Maybe there's some way, dealing with hashes on columns and joins. I don't know how to start. Please, advise me!</p>
  
  <p><strong>EDIT</strong><br>
  I know I can do something like this:</p>
  
  <pre><code>CREATE TABLE Test1
  (
    MI_PRINX INTEGER PRIMARY KEY AUTOINCREMENT,
    Name CHAR(100),
    Value INTEGER
  );
  
  CREATE TABLE Test2
  (
    MI_PRINX INTEGER PRIMARY KEY AUTOINCREMENT,
    Name CHAR(100),
    Value INTEGER
  );
  
  INSERT INTO Test1 (Name, Value) VALUES('Name1', 1);
  INSERT INTO Test1 (Name, Value) VALUES('Name2', 2);
  INSERT INTO Test1 (Name, Value) VALUES('Name3', 3);
  INSERT INTO Test1 (Name, Value) VALUES('Name4', 4);
  
  INSERT INTO Test2 (Name, Value) VALUES('Name1', 2);
  INSERT INTO Test2 (Name, Value) VALUES('Name3', 3);
  INSERT INTO Test2 (Name, Value) VALUES('Name4', 5);
  INSERT INTO Test2 (Name, Value) VALUES('Name5', 6);
  INSERT INTO Test2 (Name, Value) VALUES('Name6', 7);
  INSERT INTO Test2 (Name, Value) VALUES('Name7', 8);
  
  -- suppose Name is unique
  
  SELECT * FROM Test1 JOIN Test2 ON Test1.Name = Test2.Name
  WHERE Test1.Value &lt;&gt; Test2.Value
  </code></pre>
  
  <p>But it's kinda uncomfortable solution, because I need to create really long queries for many columns... Any other idea?</p>