본문 바로가기
Oracle

컬럼당 최대값 최소값 구하기 keep(dense_rank first order by salary desc)

by 캡틴노랑이 2015. 7. 29.
반응형
--부서별 최소값과 최대값 구하기
select
  department_id
, max(employee_id || ' ' || last_name) keep(dense_rank first order by salary desc) maxsalary
, max(salary) maxxx
, min(employee_id || ' ' || last_name) keep(dense_rank last order by salary desc) minsalary
, min(salary) minxxx
from employees
group by department_id;

 

반응형

댓글