8. 부서번호로 ASCENDING SORT 한 후 급여가 많은 사람 순으로 출력할 때

김미숙's avatar
Jul 15, 2025
8. 부서번호로 ASCENDING SORT 한 후 급여가 많은 사람 순으로 출력할 때

내가 입력한 코드

select * from emp order by deptno asc;
급여가 많은 사람 순으로 어떻게 출력해야할 지 몰랐음
💡
order by deptno asc와 sal desc 사이를 ,(콤마)로 연결하면 부서번호 오름차순 정렬 후 급여 내림차순 정렬가능!

🛠 해결

select * from emp order by deptno asc, sal desc;
notion image
Share article

parangdajavous