DataBase -Bit

이정규 (가지마)·2023년 3월 8일

뷰 - 인라인
인라인 : select ~ from select ~ : 테이블을 대신해서 사용.(from절에)

Top N분석
ex)급여를 가장 많이 받는 사원 3명의 이름,급여를 표시하는 함수.

where rownum=2 는 에러가나옴 rownum은 특정행을 가져올수가없음.
where rownum=1 은 가능.(맨앞에 있는건 꺼내오기 가능.)

어려웠던문제
select 부서명 , 최대급여 ,이름
from(select last_name as "이름", department_name as "부서명" ,salary as "최대급여"
from employees
join departments using(department_id)
where (department_id,salary)in(select department_id ,max(salary)as salary from employees group by department_id));

[문제5]
5-1. 부서별 최대급여를 받는 사원의 부서명, 최대급여를 출력하시오
5-2. 1번 문제에 최대급여를 받는 사원의 이름도 구하시오

profile
"꾸준함이 답이다."

0개의 댓글