728x90

https://leetcode.com/problems/swap-salary/

 

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

[problem]

성별 f,m 인경우 전체 바꿔버리기

[analysis]

1. update이용해서 데이터 업뎃

-> UPDATE 테이블이름

SET 필드이름1=데이터값1, 필드이름2=데이터값2, ...

WHERE 필드이름=데이터값

 

2.. case when 이용해서 f인 경우, m인 경우 분리

-> case when 문법 : CASE WHEN 조건절 THEN 참일때 값 ELSE 거짓일 때 값 END 컬럼명

 

[solution]

728x90

+ Recent posts