Multiple choice

Consider the following database table

Table Name- EM ||||| |---|---|---|---| |empid|deptno|Salary|city| |011|501|20000|Mumbai| |012|502|15000|Gurgaun| |013|503|24000|Delhi| |014|504|30000|Lucknow| and Table name-Dep ||| |---|---| |Deptno|deptname| |501|sales| |502|Hr| |503|CS| |504|EC|

Find the details of departments in which employees are working.

  1. SELECT * FROM EMP WHERE DEPTNO IN(SELECT DISTINCT DEPTNO FROM EMP)

  2. SELECT * FROM DEPT WHERE DEPTNO IN(SELECT DISTINCT DEPTNO FROM EMP)

  3. SELECT * FROM DEPT WHERE EXISTS(SELECT DEPTNO FROM EMP WHERE EMP.DEPTNO=DEPT.DEPTNO)

  4. Both (2) and (3)

  5. None of the above

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

Both are the correct syntax for the correct output.