627. 交换工资
目录
1. 题目
2. 解题
方法1:case when
update salary
set sex=case
when sex='f' then 'm'
else 'f'
end
方法2:if
UPDATE
salary s
SET
sex=IF(s.`sex`='m','f','m');
另外,关于mysql的case when可以查看这篇博客https://blog.csdn.net/u013514928/article/details/80969949