SQL

so.log·2022년 12월 7일
1

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.

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.

Swap Salary 리트코드 #627 


UPDATE salary
SET sex = CASE WHEN sex ='f' THEN 'm' ELSE 'f' END

profile
우당탕탕! 끄적이는 개발공부 👋

0개의 댓글