Second Highest Salary
Qustion:
Write a SQL query to get the second highest salary from the Employee table.
Id | Salary |
---|---|
1 | 100 |
2 | 200 |
3 | 300 |
For example, given the above Employee table, the second highest salary is 200. If there is no second highest salary, then the query should return null.
Answer:
SELECT max(Salary) FROM Employee WHERE Salary < (SELECT max(Salary) FROM Employee)
说句实在话,答案看不懂~没学过sql,不懂那个语法~记得当时学Java的时候,附赠有SQL的教程,先去学~我还会回来的~~