Multiple choice technology programming languages

SELECT name,salary , dept FROM emp e WHERE NOT EXISTS (SELECT 1 FROM dept WHERE deptno = e.dept); Which employees are retrieved from the above query:

  1. Employees who work for a department that is not listed in DEPT table.

  2. Employees who work from department 1

  3. Employees who work for a department with more than 1 employee

  4. Employees who work for a department other than department 1

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

NOT EXISTS returns true when the subquery returns no rows. This query selects employees where their department number doesn't exist in the DEPT table - meaning they're orphaned records with invalid department references. This is a common pattern for finding referential integrity violations. Options B, C, and D describe specific department conditions that don't match the NOT EXISTS logic.