What is its output?

Click the Exhibit button to examine the data of the EMPLOYEES table.

Evaluate this SQL statement:
SELECT e.employee_id “Emp_id”, e.emp_name “Employee”, e.salary,
m.employee_id “Mgr_id”, m.emp_name “Manager”
FROM employees e JOIN employees m
ON (e.mgr_id = m.employee_id)
AND e.salary > 4000;
What is its output?

Click the Exhibit button to examine the data of the EMPLOYEES table.

Evaluate this SQL statement:
SELECT e.employee_id “Emp_id”, e.emp_name “Employee”, e.salary,
m.employee_id “Mgr_id”, m.emp_name “Manager”
FROM employees e JOIN employees m
ON (e.mgr_id = m.employee_id)
AND e.salary > 4000;
What is its output?

A.
EMP_id EMPLOYEE SALARY Mgr_id Manager
——- ———- ——— ————- ————–110 Bob 8000 Bob
120 Ravi 6500 110 Ravi
108 Jennifer 6500 110 Jennifer
103 Chris 4200 120 Chris
105 Diana 5000 108 Diana

B.
EMP_id EMPLOYEE SALARY Mgr_id Manager
——- ———- ——— ————- ————–120 Ravi 6500 110 Bob
108 Jennifer 6500 110 Bob
103 Chris 4200 120 Ravi
105 Diana 5000 108 Jennifer

C.
EMP_id EMPLOYEE SALARY Mgr_id Manager
——- ———- ——— ————- ————–110 Bob 8000
120 Ravi 6500 110 Bob
108 Jennifer 6500 110 Bob
103 Chris 4200 120 Ravi
105 Diana 5000 108 Jennifer

D.
EMP_id EMPLOYEE SALARY Mgr_id Manager
——- ———- ——— ————- ————–110 Bob 8000 110 Bob
120 Ravi 6500 120 Ravi
108 Jennifer 6500 108 Jennifer
103 Chris 4200 103 Chris
105 ana 5000 105 Dina

E.
The SQL statement produces an error.

Explanation:

This statement lists the ID, name, and salary of the employee, and the ID and name of the
employee’s manager, for all the employees who have a manager and earn more than 4000
Incorrect Answers:
A: This output will be provided by different query.
C: This output will be provided by different query.
D: This output will be provided by different query.
E: This SQL query will not produce error, it will show results as in answer B.OCP Introduction to
Oracle 9i: SQL Exam Guide, Jason Couchman, p. 118-122Chapter 3: Advanced Data Selection in
Oracle



Leave a Reply 0

Your email address will not be published. Required fields are marked *