Following is the command to fetch maximum salary form empsalary table in mysql
select max(salary) from empsalary;
but I want to fetch employee who got fourth highest from the list of employee.
I don’t want to use trigger or function because I know there is direct command to fetch.
It’s essentially as Col. Shrapnel has stated. Select the top 4 records as sorted by salary and then choose the last record. If it’s important to do it all in SQL, you could do something like this: