627. 变更性别
请你编写一个 SQL 查询来交换所有的 ‘f’ 和 ‘m’ (即,将所有 ‘f’ 变为 ‘m’ ,反之亦然),仅使用单个 update 语句 ,且不产生中间临时表。
注意,你必须仅使用一条 update 语句,且不能使用 select 语句。
查询结果如下例所示。
update语句:
update 表名
set 列名 = 新值,.....
where 筛选条件;
题解:
# Write your MySQL query statement below
update salary
set sex= case sex
when 'f' then 'm'
else 'f'
end;