1Z0-061 · Question #42
Examine the structure of the employees table: There is a parent/child relationship between EMPLOYEE_ID and MANAGER_ID. You want to display the name, joining date, and manager for all the employees…
The correct answer is B. Option B. Try it yourself with the scott.emp table: SELECT e.ename,NVL(m.ename,'No Manager') Manager FROM emp e JOIN emp m ON (e.mgr=m.empno); SELECT e.ename,NVL(m.ename,'No Manager') Manager FROM emp e LEFT OUTER JOIN emp m ON (e.mgr=m.empno); SELECT e.ename,NVL(m.ename,'No Manager')…
Question
Examine the structure of the employees table:
There is a parent/child relationship between EMPLOYEE_ID and MANAGER_ID. You want to display the name, joining date, and manager for all the employees. Newly hired employees are yet to be assigned a department or a manager. For them, 'No Manager1 should be displayed in the manager column. Which SQL query gets the required output?
Exhibits
Options
- AOption A
- BOption B
- COption C
- DOption D
How the community answered
(19 responses)- A5% (1)
- B74% (14)
- C5% (1)
- D16% (3)
Explanation
Try it yourself with the scott.emp table: SELECT e.ename,NVL(m.ename,'No Manager') Manager FROM emp e JOIN emp m ON (e.mgr=m.empno); SELECT e.ename,NVL(m.ename,'No Manager') Manager FROM emp e LEFT OUTER JOIN emp m ON (e.mgr=m.empno); SELECT e.ename,NVL(m.ename,'No Manager') Manager FROM emp e NATURAL JOIN emp m ON (e.mgr=m.empno); Not A: It works too, but it is a INNER JOIN and won't print the rows with 'No Manager'. Not C: It works too, but the join order is wrong, and therefor the rows with 'No Manager' not Not D: Syntax error. There is no ON ... in Natural JOIN
Topics
Community Discussion
No community discussion yet for this question.

