← Quiz: Subqueries and Views: all 10 questions
Quiz: Subqueries and Views · Question 6 of 10
SELECT name FROM employees WHERE deptid = (SELECT deptid FROM departments) fails or misbehaves. Why?
SELECT name FROM employees WHERE dept_id = (SELECT dept_id FROM departments) fails or misbehaves. Why?
- A.Subqueries are not allowed in WHERE
- B.dept_id is not a column
- C.The subquery returns many rows, but
=expects one value — use IN - D.departments must be joined first
Answer & explanation
Correct answer: The subquery returns many rows, but = expects one value — use IN
A single-value comparison needs a subquery that returns one value.
Can you get the rest right without peeking?
Take the timed Quiz: Subqueries and Views quiz free. Pass it to earn XP and count towards your certificate.
Start the quiz →