본문 바로가기
💻 하나씩 차곡차곡/프로그래머스 (SQL)

[GROUP BY/LEVEL3] 부서별 평균 연봉 조회하기 (MySQL)

by 뚜루리 2024. 12. 4.
728x90
320x100

MySQL

SELECT A.DEPT_ID
, DEPT_NAME_EN
, ROUND(AVG(SAL),0) AS AVG_SAL
FROM HR_DEPARTMENT A, HR_EMPLOYEES B
WHERE A.DEPT_ID = B.DEPT_ID
GROUP BY DEPT_ID, DEPT_NAME_EN
ORDER BY AVG_SAL DESC

 

728x90
320x100