CREATE TABLE foo (id INTEGER,value INTEGER); Doing a SELECT * FROM foo WHERE id=1 migth yield something like this: id value 1 56 1 95 1 34 1 12 1 116 After having messed about with these values in my script, I end up with this: id value 1 56 1 34 1 22 Now, what is best practice: deleting all the current rows and inserting the new id/value pairs anew, or looping over the current data again, deleting where id/value no longer exists and then inserting the new id/value pairs?