sql to update DB mechanism