I have this 'table A'. It contains two columns; email and email_alias. A sample is below:   =====================================    = email          | email_alias      =    =====================================    = email1@abc.com | alias1@abc.com   =    = email1@abc.com | alias2@abc.com   =    = email2@abc.com | alias3@abc.com   =    = email3@abc.com | alias4@abc.com   =    = email3@abc.com | alias5@abc.com   =    = email3@abc.com | alias6@abc.com   =    = email3@abc.com | alias7@abc.com   =    =====================================As you can see only the alias need be unique. Anyways, i have a script that will allow a user to update this table.  Previously, i would truncate the entire table, and then reinsert the latest entries.   Problem: It's possible for a user to see an empty or incomplete list.My next thought, was to flag all of the old fields to be deleted, insert the new, and then go back and delete the flagged entries.   Problem: It's possible for the user to see duplicate entries.I could say if email = new.email & email_alias = new.email_alias, then do nothing, else, add record. Problem: Old records will still be presentI would rather not do this, but is my only option to create a temporary table? Remove the records from the old table that don't exist in the temp table, and add records from the temp table that don't exist in the old table?
Updating all records in MySQL table while still available to the user
database;mysql
Problem: It's possible for a user to see an empty or incomplete list.Problem: It's possible for the user to see duplicate entries.I suspect that you are not using Transactions when making these updates. With Transactions, users will only see the end result of your [transactional] manipulations.  They will never see the intermediate state where duplicates are present (or no rows at all).  Begin transaction Insert/ Update/ Delete, as required Commit Transactional changes should be quick because many DBMSs will block access to the rows or tables being worked on until the Commit (or Rollback) is executed.