sql #oracle #pivot #exitst
-
201221 SQLData Engineering/SQL 2020. 12. 21. 23:11
-exists, not exists / in, not in(not in은 널값 체크해주고 있으면 조건절 추가) -메인쿼리 테이블 값을 하나씩 뽑아서 서브쿼리 값과 비교, 조건에 부합하면 출력 (select avg(salary)\r\n\t\tfrom employees\r\n\t\twhere department_id = o.department_id);\n\n select e2.last_name, e2.salary, e1.avg_sal\r\nfrom (select department_id, round(avg(salary)) avg_sal\r\n\tfrom employees\r\n\tgroup by department_id) e1, employees e2\r\nwhere e1.department_id = e2...