Com base no DER abaixo, qual a construção correta para a solicitaçãoseguinte? Encontre os empregados que têm, no mínimo, uma pessoa subordinada a cada um deles.
a.
SELECT EMPLOYEE_ID, MANAGER_ID, FIRST_NAME, LAST_NAME,
JOB_ID, DEPARTMENT_ID, SALARY
FROM EMPLOYEES E
WHERE EXISTS (SELECT EMPLOYEE_ID
FROM EMPLOYEES
WHERE EMPLOYEES.MANAGER_ID =
E. EMPLOYEE_ID)
ORDER BY EMPLOYEE_ID;
b.
SELECT EMPLOYEE_ID, MANAGER_ID, FIRST_NAME, LAST_NAME,
JOB_ID, DEPARTMENT_ID, SALARY
FROM EMPLOYEES E
WHERE NOT EXISTS (SELECT EMPLOYEE_ID
FROM EMPLOYEES
WHERE EMPLOYEES.MANAGER_ID =
E. EMPLOYEE_ID)
ORDER BY EMPLOYEE_ID;
c.
SELECT EMPLOYEE_ID, MANAGER_ID, FIRST_NAME, LAST_NAME,
JOB_ID, DEPARTMENT_ID, SALARY
FROM EMPLOYEES E
WHERE EXISTS (SELECT EMPLOYEE_ID
FROM EMPLOYEES)
ORDER BY EMPLOYEE_ID;
d.
SELECT EMPLOYEE_ID, MANAGER_ID, FIRST_NAME, LAST_NAME,
JOB_ID, DEPARTMENT_ID, SALARY
FROM EMPLOYEES E
WHERE EMPLOYEE_ID >= (SELECT EMPLOYEE_ID
FROM EMPLOYEES
WHERE EMPLOYEES.MANAGER_ID =
E. EMPLOYEE_ID)
ORDER BY EMPLOYEE_ID;
e.
SELECT EMPLOYEE_ID, MANAGER_ID, FIRST_NAME, LAST_NAME,
JOB_ID, DEPARTMENT_ID, SALARY
FROM EMPLOYEES E
WHERE EXISTS IN (SELECT EMPLOYEE_ID
FROM EMPLOYEES
WHERE EMPLOYEES.MANAGER_ID =
E. EMPLOYEE_ID)
ORDER BY EMPLOYEE_ID;
Soluções para a tarefa
Respondido por
14
Resposta:
Resposta:
A:
Explicação:
SELECT
EMPLOYEE_ID,
MANAGER_ID,
FIRST_NAME,
LAST_NAME,
JOB_ID,
DEPARTMENT_ID,
SALARY
FROM
EMPLOYEES
WHERE
EXISTS( SELECT
EMPLOYEE_ID
FROM
EMPLOYEES
WHERE
EMPLOYEES.MANAGER_ID = E.EMPLOYEE_ID)
ORDER BY EMPLOYEE_ID;
Perguntas interessantes
História,
6 meses atrás
Inglês,
6 meses atrás
Sociologia,
6 meses atrás
Química,
7 meses atrás
Sociologia,
7 meses atrás
Espanhol,
11 meses atrás
Matemática,
11 meses atrás