Multiple choice

Select a query to display the employee name, salary for all employees who report to king.

consider the following relation schema ..... EMP(ENAME,EMPNO,SAL,COMM,DEPTNO,JOB,MGR,HIREDATE)...

  1. select ENAME, SAL from EMP where MGR = (select MGR from EMP where ENAME='KING');

  2. select ENAME, SAL from EMP where MGR = (select EMPNO from EMP where ENAME='KNG');

  3. select ENAME, SAL from EMP where MGR = (select EMPNO from EMP where ENAME='KING');

  4. select ENAME, SAL from EMP where EMPNO = (select EMPNO from EMP where ENAME='KING');

  5. none of these

Reveal answer Fill a bubble to check yourself
C Correct answer
Explanation

In the inner loop the query will fetch the employee number of King and matches with the manager number of all employees in the outer loop..so It will fetch the correct data.