title: Can I add rows to MySQL before removing all old rows (except same primary)?
body: <p>If I have a table that has these rows:</p>
  
  <pre><code>animal (primary)
  -------
  man
  dog
  cow
  </code></pre>
  
  <p>and I want to delete all the rows and insert my new rows (that may contain some of the same data), such as:</p>
  
  <pre><code>animal (primary)
  -------
  dog
  chicken
  wolf
  </code></pre>
  
  <p>I could simply do something like:</p>
  
  <pre><code>delete from animal;
  </code></pre>
  
  <p>and then insert the new rows.</p>
  
  <p>But when I do that, for a split second, 'dog' won't be accessible through the SELECT statement.</p>
  
  <p>I could simply insert ignore the new data and then delete the rest, one by one, but that doesn't feel like the right solution when I have a lot of rows.</p>
  
  <p>Is there a way to insert the new data and then have MySQL automatically delete the rest afterward?</p>
  
  <p>I have a program that selects data from this table every 5 minutes (and the code I'm writing now will be updating this table once every 30 minutes), so I would like to be as accurate as possible at all times, and I would rather have too many rows for a split second than too few rows for the same time.</p>
  
  <p>Note: I know that this may seem like it is unnecessary but I just feel like if I leave too many of those unlikely possibilities in different places, there will be times where things go wrong.</p>