Change column values but keep order in MySQL
This sounds like an activity that a college teacher might come up with to see if someone understands math and has a little bit of imagination, as this sort of thing would almost never be required outside of an educational setting ... and I say this as someone who works in academia.
That said, one way this could be accomplished would be with a subquery that first determines the &quot;proper&quot; id. An UPDATE statement can then be used to match on the &quot;proper_id&quot; to fix the data. Here is the sub-query:
SELECT CASE WHEN id % 2 = 0 THEN id - 1 ELSE id + 1 END as proper_id,
       name
  FROM Student
 ORDER BY id

I'll leave the rest to you