코딩테스트/MySQL
[프로그래머스 Level 4] 연간 평가점수에 해당하는 평가 등급 및 성과금 조회하기 (MySQL)
최-코드
2025. 2. 9. 20:34
https://school.programmers.co.kr/learn/courses/30/lessons/284528
프로그래머스
SW개발자를 위한 평가, 교육, 채용까지 Total Solution을 제공하는 개발자 성장을 위한 베이스캠프
programmers.co.kr
select emp_no, emp_name, (case when avg(score)>=96 then 'S'
when avg(score)>=90 then 'A'
when avg(score)>=80 then 'B'
else 'C'
end) as grade,
(case when avg(score)>=96 then sal*0.2
when avg(score)>=90 then sal*0.15
when avg(score)>=80 then sal*0.1
else 0
end) as bonus
from hr_employees natural join hr_grade
group by emp_no, emp_name, sal