How to find only %th Highest Sal

Answers were Sorted based on User's Feedback



How to find only %th Highest Sal..

Answer / sujit pingale

Ans: select distinct(a.salary) from customers a where &n =
(select count(distinct(b.salary)) from customers b where
a.salary <= b.salary);

It will ask you to enter number in input box which salary
you want to see

Is This Answer Correct ?    3 Yes 0 No

How to find only %th Highest Sal..

Answer / sujitpingale

Ans: select distinct(a.salary) from customers a where &n =
(select count(distinct(b.salary)) from customers b where
a.salary <= b.salary);

Enter value in inputbox. If you enter 1 then it will give
highest salary

Is This Answer Correct ?    2 Yes 0 No

How to find only %th Highest Sal..

Answer / ajit

select e.*, rn
from ( select empno, ename, sal, deptno, dense_rank() over ( order by sal desc ) rn
from emp) e
where rn = & rn;

Is This Answer Correct ?    2 Yes 0 No

How to find only %th Highest Sal..

Answer / abhishekjaiswal

SELECT A.FIRST_NAME,
       A.SALARY
   FROM EMPLOYEES A
   WHERE 3 = ( SELECT COUNT(*) -- Replace 3 with any value of (N - 1)
               FROM EMPLOYEES B
               WHERE B.SALARY > A.SALARY)

Is This Answer Correct ?    1 Yes 0 No

How to find only %th Highest Sal..

Answer / pavan

select e.* from emp e where &n=(select count(distinct e1.sal)from emp e1 where e.sal>e1.sal)

Is This Answer Correct ?    0 Yes 0 No

How to find only %th Highest Sal..

Answer / ajit

select *
from emp
where sal = ( select max(sal)
from emp
where level = &n
connect by prior sal > sal
group by level);

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More SQL PLSQL Interview Questions

what are the performance and scalability characteristics of mysql? : Sql dba

0 Answers  


i have a table emp and columns ename,empno,mgr_id,i need ename,manager name as result i.e employee respective manager.. example empno ename mgr_id 1 john 3 2 paul 3 3 smith 1 4 kevin 1 5 stewart 2 result has to look like this ename manager john smith paul smith smith john kevin john stewart paul can u plz help me out in this.....

8 Answers  


What is parallel hint?

0 Answers  


Hi all, i have a table as follows empid empname mgrid deptid 1 a 3 4 2 b 1 5 3 c 2 3 4 d 3 6 5 e 4 7 i want the output as empname mgrname a c b a c b d c e d

4 Answers  


can i call procedure in package

3 Answers   TCS,






Can we create a trigger on view?

0 Answers  


what is a cursor? : Sql dba

0 Answers  


How can you load microsoft excel data into oracle? : aql loader

0 Answers  


Can we insert data into view?

0 Answers  


Can you sum a count in sql?

0 Answers  


What are the types of index in sql?

0 Answers  


Write the alter statement to enable all the triggers on the t.students table.

0 Answers  


Categories