Write SQL query to get the second highest salary
select max(Salary) as SecondHighestSalary
from Employee
where Salary<(select max(Salary) from Employee);
I would like to ask why cannot compare directly Salary < max(Salary) at the where
in SQL?