Consider the following relation schema R along with the tuples. Employee(name,…
2017
Consider the following relation schema R along with the tuples.
Employee(name, salary) = {<e1, 10000>, <e2, 5000>, <e3, 2500>, <e4, 7500>, <e5, 8900>, <e6, 9800>}
What is the output of following SQL query?
SELECT name, MAX(salary) FROM Employee WHERE salary < (SELECT MAX(salary) FROM Employee);
- A.
<e3, 2500>
- B.
<e5, 8900>
- C.
<e6, 9800>
- D.
<e1, 10000>
Attempted by 221 students.
Show answer & explanation
Correct answer: C
The inner subquery returns the maximum salary, which is 10000. The outer query filters out rows where salary < 10000. Among the remaining tuples (e2, e3, e4, e5, e6), the maximum salary is 9800, which belongs to e6.