Let us take a table named the employee.
To find Nth highest salary is:
select distinct(salary)from employee order by salary desc limit n-1,1
if you want to find 3rd largest salary:
select distinct(salary)from employee order by salary desc limit 2,1
To display the nth highest salary from a table in MySQL, you can use the following query:
SELECT salary
FROM employees
ORDER BY salary DESC
LIMIT n-1, 1;
Replace employees
with the name of your table and salary
with the name of your salary column. Replace n
with the desired rank of the salary you want to retrieve. For example, if you want to retrieve the 3rd highest salary, replace n
with 3
.