데이터 분석/SQL 연습문제
627. Swap Salary (LeetCode)
중급닌자 연습생
2022. 9. 15. 20:00
Swap Salary - LeetCode
Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview.
leetcode.com
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
