title: How to update rows of two tables that have foreign key restrictions
body: <p>I have two tables: one is foreign reference table lets say <strong><em>table a</em></strong> and other one is the data table lets say <strong><em>table b</em></strong>.
  Now, when I need to change the data in <strong><em>table b</em></strong>, but I get restricted by <strong><em>table a</em></strong>.
  How can I change "rid" in both tables without getting this message?</p>
  
  <blockquote>
    <p>"ERROR: insert or update on table "table a" violates foreign key
    constraint "fk_boo_kid" SQL state: 23503</p>
  </blockquote>
  
  <p>Detail: Key (kid)=(110) is not present in table "table b".</p>
  
  <p>Example query to update both tables: </p>
  
  <pre><code>UPDATE table b table a SET rid = 110 WHERE rid =1
  </code></pre>
  
  <pre>
  table b 
  +-----+-------+-------+
  | rid | ride  | qunta |
  +-----+-------+-------+
  |   1 |  car  |     1 |
  |   2 |  bike |     1 |
  +-----+-------+-------+  
  
  table a
  +-----+-----+------------+
  | kid | rid |    date    |
  +-----+-----+------------+
  |   1 |   1 | 20-12-2015 |
  |   2 |   2 | 20-12-2015 |
  +-----+-----+------------+
  </pre>