Query: SELECT sal FROM `emp` order by sal desc limit (n-1),1If the question: "how to display 4th highest (salary) record from customer table."The query will SELECT sal FROM `emp` order by sal desc limit 3,1
select sal from emp order by descending where rownum=4
There are two ways - Using LIMIT clause - Special SQL
Using LIMIT there are issues that if table has got same salary (field) value multiple times, but this will show you only one record, then you will not get to know that there are also others with same salary.
Another SQL Approach is - ------------- select a.empid, a.salary from employees as a where 2 =(select count(distinct b.salary) from employees as b where b.salary >=a.salary) --------------- this query will return you all the rows which comes under this criteria.