how to find 4th highest salary of employee in mysql code example
Example 1: how to find 2nd highest salary in mysql
#2nd Most highest salary using Group By, Order By & Limit clause
SELECT sal FROM emp GROUP BY sal ORDER BY sal DESC LIMIT 1, 1;
Example 2: how to find 2nd highest salary in mysql
#2nd Most highest salary using dense_rank()
SELECT sal
FROM (SELECT dense_rank() over(ORDER BY sal DESC) AS R, sal FROM emp) employee
WHERE R = 2;