Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

select last_name, ( select count (*) from departments) from employees where sala

ID: 3643706 • Letter: S

Question

select last_name, ( select count (*) from departments) from employees
where salary = (select salary from employees);
What is wrong with it?

Choose one answer.
A. Nothing is wrong-the statement should run without error.
B. The statement will fail because the subquery in the SELECT list references a table that is not listed in the FROM clause.
C. The statement will fail if the conditional subquery returns more than one row.
D. The statement will run but is extremely inefficient because of the need to run the second subquery once for every row in EMPLOYEES.

Explanation / Answer

C. The statement will fail if the conditional subquery returns more than one row.

we can use "=" operator only when the sub-query returns only one row
other wise we have to use operators like "ANY", "ALL"...etc.