Subqueries · SQL SQL

Consider the query: SELECT FROM employees WHERE departmentid IN (SELECT departmentid FROM departments WHERE location = 'New York'); Which relational…

Practice question from Subqueries (SQL SQL), with the correct answer and a step-by-step solution.

easy · MCQ · Q-68D7DB

Consider the query: SELECT * FROM employees WHERE department_id IN (SELECT department_id FROM departments WHERE location = 'New York'); Which relational operator is equivalent to the IN operator when working with a subquery returning a single column?

  1. A.= ANYCorrect answer
  2. B.= ALL
  3. C.EXISTS
  4. D.SOME NOT

Solution

The IN operator is functionally equivalent to the = ANY (or = SOME) operator. It checks if the expression matches at least one value in the result set returned by the subquery.

More from Subqueries

All of Subqueries

Practise more SQL

Sign up free for adaptive practice on this chapter, with instant feedback and hints on every question.

Start practising free

Free to start · No credit card needed