update table and insert