首先是题目:
1:可以使用case when 关键字
update salary set sex=case sex when 'm' then 'f' else 'm' end;
或者
update salary set sex=case when sex='m' then 'f' else 'm' end;
2:也可以用if函数,有点像java的三目运算符
update salary set sex=if(sex='m','f','m');
3:字符串函数+异或
update salary set sex=char(ascii('m')^ascii('f')^ascii(sex));