Select the SQL statement which will list the employee(empno) and the project numbers(projno) from the EMPACT table that has an employee(empno) whose salary(salary) is in the top three salaries for all employees from the EMP table.
A . SELECT empno, projno
FROM empact ep
WHERE ep.empno IN
(SELECT em.empno
FROM emp em
ORDER BY salary DESC)
FETCH FIRST 3 ROWS ONLY;
B . SELECT empno, projno
FROM empact
WHERE empno IN
(SELECT empno
FROM emp
FETCH FIRST 3 ROWS ONLY);
C . SELECT ep.empno, projno
FROM empact ep
WHERE ep.empno IN
(SELECT em.empno
FROM emp em
ORDER BY salary
FETCH FIRST 3 ROWS ONLY);
D . SELECT ep.empno, projno
FROM empact ep
WHERE ep.empno IN
(SELECT em.empno
FROM emp em
ORDER BY salary DESC
FETCH FIRST 3 ROWS ONLY);
Answer: A
Explanation:
Reference: https://www.ibm.com/support/knowledgecenter/SSCRJT_5.0.1/ com.ibm.swg.im.bigsql.commsql.doc/doc/r0059213.html
Leave a Reply