ORDER BY

In MySQL, if an UPDATE statement includes an ORDER BY clause, the rows will be updated in the order specified by the clause.

Input

# ORDER BY 
UPDATE  employees SET department_id=department_id+1  ORDER BY id;

Output

-- ORDER BY 
UPDATE "public"."employees" SET "department_id" = department_id+1;