Oracle (2) 썸네일형 리스트형 기본 SQL 연습하기 2 1. JOIN과 서브쿼리 활용 : employees 테이블과 orders 테이블을 사용해 각 직원이 담당한 주문의 수를 직원의 이름과 함께 출력하기.(주문이 없는 직원도 포함)SELECT e.first_name || ' ' || e.last_name AS employee_name, COUNT(o.order_id) AS order_count FROM employees eLEFT JOIN orders o ON e.employee_id = o.order_idGROUP BY e.first_name, e.last_nameORDER BY order_count DESC;LEFT JOIN : 주문이 없는 직원도 결과에 포함.COUNT(o.order_id)는 주문 수 계산, GROUP BY로 직원별 집계.2. 집계 함.. 기본 SQL 연습하기 샘플 데이터를 이용해서 기본 SQL 기능 연습하기!샘플 데이터 받는 곳.https://www.oracletutorial.com/getting-started/oracle-sample-database/ Oracle Sample DatabaseThis tutorial introduces you an Oracle sample database and shows you how to load it into an Oracle database for practicingwww.oracletutorial.com다운 받은 파일에서 ot_data.sql을 f5해서 데이터 삽입 시 오류가 나서날짜 to_date(...) 부분 수정해서 사용했습니다.Insert into EMPLOYEES (EMPLOYEE_ID,FIRST_NAME,.. 이전 1 다음