본문 바로가기
데이터 분석/SQL 연습문제

627. Swap Salary (LeetCode)

2022. 9. 15.
 

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

2022.09.15

댓글