hyezdata 님의 블로그

Swap Sex of Employees 본문

코딩테스트

Swap Sex of Employees

hyezdata 2026. 5. 30. 14:26
# 성별 남여 서로 바꾸기
# select문 작성x update문으로만

update salary
set sex= case when sex='m' then 'f'
              else 'm'
         end

 

update문 오랜만에 사용해서 다시 찾아봄

UPDATE 테이블_이름
SET 열_이름1 = 변경할_값1, 열_이름2 = 변경할_값2
WHERE 조건;

 

 

 

Swap Sex of Employees - LeetCode

Can you solve this real interview question? Swap Sex of Employees - Table: Salary +-------------+----------+ | Column Name | Type | +-------------+----------+ | id | int | | name | varchar | | sex | ENUM | | salary | int | +-------------+----------+ id is

leetcode.com

 

728x90
반응형

'코딩테스트' 카테고리의 다른 글

Exchange Seats  (0) 2026.05.30
Biggest Single Number  (0) 2026.05.25
Triangle Judgement  (0) 2026.05.25
Sales Person  (0) 2026.05.25
Customer Placing the Largest Number of Orders  (0) 2026.05.22