title: Delete all then insert all, or update, delete and insert as needed?
body: <p>I have a web form that is used to create and update personal information. On save, I collect all the info in a large multidimensional <code>JSON</code> array. When updating the database, the information will potentially consists of three parts. New rows to be created, rows that need to be updated and rows that need to be deleted. These rows will also be across about 5 tables.</p>
  
  <p>My question is this, how should I approach the MySQL queries? My initial thought was to <code>DELETE</code> all the information from all the tables, and do a clean <code>INSERT</code> of all the new information in one go. I guess the other approach would be to do 3 queries: <code>UPDATE</code> all those with an existing ID; <code>DELETE</code> all those marked for deletion and <code>INSERT</code> all the newly created data (data without existing ID's).</p>
  
  <p>Which of these approaches would be best, or is there a better way of doing this? Thanks for any advice. I appreciate it.</p>