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?
- A.= ANYCorrect answer
- B.= ALL
- C.EXISTS
- 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
- Which of the following best describes a correlated subquery?
- What is the primary operational difference between using the EXISTS operator with a correlated subquery versus using IN with a subquery?
- Explain the concept of a derived table (also known as an inline view) and state where it must be placed in a SQL query.
- Which of the following queries correctly uses a scalar subquery in the SELECT list to retrieve each employee's salary alongside the company…
Practise more SQL
Sign up free for adaptive practice on this chapter, with instant feedback and hints on every question.
Start practising freeFree to start · No credit card needed