You can do this with a single UPDATE , but I would not worry.
In this situation, it makes sense to use three separate updates. Trying to do this with one statement makes your code less readable and more error prone.
But if you really need a single operator, you are here:
UPDATE your_table SET order = CASE id WHEN 3 THEN 1 WHEN 5 THEN 4 WHEN 1 THEN 1 END WHERE id IN (3, 5, 1)
source share