QuestionQ127

VerifiedUsing Conversion Functions and Conditional Expressions

Examine the structure of the employees table:

Question Image

A parent/child relationship exists between EMPLOYEE_ID and MANAGER_ID.

You need to display the name, joining date, and manager for all employees. Newly hired employees have not yet been assigned a department or a manager. For them, 'No Manager1 should appear in the manager column.

Which SQL query returns the required output?

Question Image

Explanation

A LEFT OUTER JOIN preserves all employee rows from e, even when e.MANAGER_ID has no matching manager row in m. For those unmatched rows, m.last_name is null, and NVL returns the specified replacement text. Oracle documents that a left outer join returns all rows from its left table and nulls for unmatched right-table columns.

Learn more

Community Discussion

No comments yet. Be the first to start the discussion!