Table Employee has 10 records. It has a non-NULL SALARY column which is also…
2025
Table Employee has 10 records. It has a non-NULL SALARY column which is also UNIQUE.
The SQL statement
SELECT COUNT(*) FROM Employee WHERE SALARY > ANY (SELECT SALARY FROM EMPLOYEE);
prints
- A.
10
- B.
9
- C.
5
- D.
0
Attempted by 241 students.
Show answer & explanation
Correct answer: B
Explanation : Correct answer is 9.
The subquery (SELECT SALARY FROM Employee) returns all 10 salary values.
The "ANY" operator checks whether the outer "SALARY" is greater than at least one value in the subquery result.
This means:
SALARY > ANY(all salaries) ⇒ SALARY > minimum salary
Since the "SALARY" column is UNIQUE and non-NULL, there is exactly one minimum salary.
The row with the minimum salary does not satisfy the condition.
The remaining 9 rows have salaries greater than the minimum, so they do satisfy the condition.
Therefore, the query counts all such rows: 9