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]
'MS SQL > MS SQL : Leetcode' 카테고리의 다른 글
SQL - 586. Customer Placing the Largest Number of Orders (select, count) (0) | 2022.04.26 |
---|---|
SQL - 511. Game Play Analysis I (min, group by) (0) | 2022.04.26 |
SQL - 183. Customers Who Never Order (left join, where) (0) | 2022.04.26 |
SQL - Leetcode 620. Not Boring Movies (where, order by) (0) | 2022.04.25 |
SQL - Leetcode 175. Combine Two Tables (left join) (0) | 2022.04.25 |