Chapter 11 Snippets

p. 348

Step 3:

SELECT Department.DEPARTMENT_ID, stuff
Department.DEPARTMENT_NAME, for sale
Department.MANAGER_ID, here
Manager.LAST_NAME
FROM DEPARTMENTS Department,
EMPLOYEES Manager
WHERE Department.MANAGER_ID = Manager.EMPLOYEE_ID

p. 353

Step 5:

SELECT Manager.EMPLOYEE_ID,
Manager.LAST_NAME,
Manager.SALARY,
Manager.JOB_ID,
COUNT(Reports.EMPLOYEE_ID) AS NUM_REPORTS
FROM EMPLOYEES Manager,
EMPLOYEES Reports
WHERE Manager.EMPLOYEE_ID = Reports.MANAGER_ID
GROUP BY Manager.EMPLOYEE_ID,
Manager.LAST_NAME,
Manager.SALARY,
Manager.JOB_ID