LeetCode #627 交换工资

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;

猜你喜欢

转载自blog.csdn.net/a912952381/article/details/80782905