https://leetcode-cn.com/problems/swap-salary/description/
吐槽一下:题目应该是交换性别吧!!!
条件更新,男女性别交换。
用set = case,when 条件 then 修改值,end这样的语法去判断条件以及更新对应值
update salary set sex = case when sex = 'm' then 'f' when sex = 'f' then 'm' end;
https://leetcode-cn.com/problems/swap-salary/description/
吐槽一下:题目应该是交换性别吧!!!
条件更新,男女性别交换。
用set = case,when 条件 then 修改值,end这样的语法去判断条件以及更新对应值
update salary set sex = case when sex = 'm' then 'f' when sex = 'f' then 'm' end;