How Can I Get The Sixth Maximum Salary From The EMP Table? In SQL Server.


Answer:
In the given examples suppose table name is emp.

select max(sal) from emp e1 where (select count(sal) from emp e2 where e2.sal>=e1.sal)=6);


Or you can use the following enquiry.

select distinct (a.sal) from emp A where &N=(select count(distinct b.sal)) from emp B where a.sal<=b.sal);

After running this query it will ask convenience for N here you can give 6 as you want to get the sixth maximum salary.

Resolved Questions:
What we really expect from the massive bright power of tomorrow computers...
It will appear in computers themselves "when the software we struggle with today develops common sense, word processors will take our text well enough to awareness our errors, and database will be familiar with that a calculation can be performed, but does...

What is the use of a sign interface even it doesn't hold methods...
Marker interface plays vital role even though it doesn't contain any methods.The main purpose is to identify the special objects from normal objects for example if you want to serialize an raise objections then how you will inform to the JVM to serialize the...

What Is The Difference Between The Mini Computer, Micro Computer,...
They are both different sizes They're just plain different