Name Null?

Examine the structure of the EMPLOYEES table.
Name Null? Type
—————– —– —— ——
EMPLOYEE_ID NOT NULL NUMBER(6)
FIRST_NAME VARCHAR2(20)
LAST_NAME NOT NULL VARCHAR2(25)
EMAIL NOT NULL VARCHAR2(25)
PHONE NUMBER VARCHAR2(20)
HIRE_DATE NOT NULL DATE
JOB_ID NOT NULL VARCHAR2(10)
SALARY NUMBER(8,2)
COMMISSION_PCT NUMBER(2,2)
MANAGER_ID NUMBER(6)
DEPARTMENT_ID NUMBER(4)
There is a parent/child relationship between EMPLOYEE_ID and MANAGER_ID.
You want to display the last names and manager IDs of employees who work for the same manager as the
employee whose EMPLOYEE_ID is 123.Which query provides the correct output?

Examine the structure of the EMPLOYEES table.
Name Null? Type
—————– —– —— ——
EMPLOYEE_ID NOT NULL NUMBER(6)
FIRST_NAME VARCHAR2(20)
LAST_NAME NOT NULL VARCHAR2(25)
EMAIL NOT NULL VARCHAR2(25)
PHONE NUMBER VARCHAR2(20)
HIRE_DATE NOT NULL DATE
JOB_ID NOT NULL VARCHAR2(10)
SALARY NUMBER(8,2)
COMMISSION_PCT NUMBER(2,2)
MANAGER_ID NUMBER(6)
DEPARTMENT_ID NUMBER(4)
There is a parent/child relationship between EMPLOYEE_ID and MANAGER_ID.
You want to display the last names and manager IDs of employees who work for the same manager as the
employee whose EMPLOYEE_ID is 123.Which query provides the correct output?

A.
SELECT e.last_name, m.manager_id
FROM employees e RIGHT OUTER JOIN employees m
on (e.manager_id = m.employee_id)
AND e.employee_id = 123;

B.
SELECT e.last_name, m.manager_id
FROM employees e RIGHT OUTER JOIN employees m
on (e.employee_id = m.manager_id)
WHERE e.employee_id = 123;

C.
SELECT e.last_name, e.manager_id
FROM employees e RIGHT OUTER JOIN employees m
on (e.employee_id = m.employee_id)
WHERE e.employee_id = 123;

D.
SELECT m.last_name, e.manager_id
FROM employees e LEFT OUTER JOIN employees m
on (e.manager_id = m.manager_id)
WHERE e.employee_id = 123;



Leave a Reply 8

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


Nikolay

Nikolay

I think D is correct. You need to display employees who work for the same manager as the EMPLOYEE_ID = 123 so you need e.manager_id = m.manager_id (D)

Marco

Marco

D is correct answer

Kate

Kate

Странная формулировка вопроса – Я никак понять не могу. И мне кажется в B ответе надо e.manager_Id = 123 или m.employee_id = 123

You want to display the last names and manager IDs of employees who work for the same manager as the employee whose EMPLOYEE_ID is 123

т.е. вы хотите продемонстрировать Фамилии и идентификационные номера сотрудников, кто работает на одного менеджера чей идентификатор как работника равне 123.
Я это понимаю, что нужен список сотрудников, которые подчиняются менеджеру 123.

Мне кажется здесь вообще нет корретного ответа.

tsev

tsev

нужен список сотрудников которые подчиняются мэнеджеру которому подчиняется сотрудник с EMPLOYEE_ID = 123

evilsoldier

evilsoldier

D should be the correct one

tsev

tsev

Why outer join?

Galdino

Galdino

The correct answer is the letter D.

Andrzej

Andrzej

D is correct.