Write a SQL query to get the second highest salary from the Employee table.
| Id | Salary | | 1 | 100 | | 2 | 200 | | 3 | 300 | <
In case of ties you want the second highest distinct value. E.g. for values 100, 200, 300, 300, you want 200.
So get the highest value (MAX(salary) => 300) and then get the highest value less than that:
MAX(salary)
select max(salary) from mytable where salary < (select max(salary) from mytable);