LeetCode/릿코드-Swap Salary-MySQL

cosmos·2021년 9월 24일
0
post-thumbnail
post-custom-banner

문제


풀이

  • write an sql query to swap all f and m values with a single update statement and no intermediate emp table(s).
  • note that you must write a single update statement, do not write any select statement for this problem.
  • the query result format is in the following example.

코드

-- leetcode, Swap Salary, mysql
UPDATE Salary
SET sex = CASE WHEN sex = 'm' THEN 'f' ELSE 'm' END

결과


출처 && 깃허브

leetcode
github

post-custom-banner

0개의 댓글