🎙 Free live masterclass · Sun, 29 Nov, 7:00 pm IST · Java Full Stack roadmap Register free →
Skills101
← 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?

  1. A.Subqueries are not allowed in WHERE
  2. B.dept_id is not a column
  3. C.The subquery returns many rows, but = expects one value — use IN
  4. 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 →