title: update data from one table to another (in a database)
body: <p>DB gurus,</p>
  
  <p>I am hoping someone can set set me on the right direction.</p>
  
  <p>I have two tables. Table A and Table B. When the system comes up, all entries from Table A are massaged and copied over to Table B (according to Table B's schema). Table A can have tens of thousands of rows.</p>
  
  <p>While the system is up, Table B is kept in sync with Table A via DB change notifications.</p>
  
  <p>If the system is rebooted, or my service restarted, I want to re-initialize Table B. However, I want to do this with the least possible DB updates. Specifically, I want to:</p>
  
  <ul>
  <li>add any rows that are in Table A, but not in Table B, and </li>
  <li>delete any rows that are not in Table A, but are in Table B</li>
  <li>any rows that are common to Table A and Table B should be left untouched</li>
  </ul>
  
  <p>Now, I am not a "DB guy", so I am wondering what is conventional way of doing this.</p>