Q:

MySQL two alternatives in updating

I have a field visible. I want to change this value based on the visible current value, then update it to the new value.
E.g.

If visible == 0 change to 1
If visible == 1 change to 0

A:

Use case when
update table set visible=case when visible=0 then 1 when visible=1 then 0 end

