Write a SQL query to get the second highest salary from the table above. Also write a query to find the nth highest salary in SQL, where n can be any number.
Try this, n would be the nth item you would want to return. SELECT DISTINCT( Salary) FROM table ORDER BY Salary DESC LIMIT n,1.
The most simple way that should work in any database is to do following: SELECT * FROM `employee` ORDER BY `salary` DESC LIMIT 1 OFFSET 2;.
Finding Nth highest salary in a table is the most common question asked in 6th highest mysql> select * from ((select * from Employee ORDER BY `sal` DESC.
One of the most common SQL interview questions is to find the Nth highest salary of employee, where N could be 2, 3, 4 or anything e.g. find.
In this section we will write SQL query to get second highest salary of . As follow up question you can ask him to find third maximum salary or.