데이터 분석/SQL 연습문제
627. Swap Salary (LeetCode)
중급닌자 연습생
2022. 9. 15. 20:00
Write an SQL query to swap all 'f' and 'm' values (i.e., change all 'f' values to 'm' and vice versa) with a single update statement and no intermediate temporary tables.
풀이
제출한 답
UPDATE SALARY
SET SEX = CASE WHEN SEX = 'F' THEN 'M'
ELSE 'F' END