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

Is sql considered coding?

0 Answers  


Mention what pl/sql package consists of?

0 Answers  


what is meant by nl2br()? : Sql dba

0 Answers  


what is 'mysqldump'? : Sql dba

0 Answers  


Why procedure is used in sql?

0 Answers  






i have table T!. A B C D NULL 1 2 3 4 NULL 5 6 7 8 NULL 9 10 11 12 NULL. I WANT COUNT OF NULL VALUES IN TABLE. WRITE A QUERY.

14 Answers   iGate, Wipro,


What is the unique index?

0 Answers  


What are literals in sql server?

0 Answers  


What is difference between inner join and cross join?

0 Answers  


What are operators available in sql?

0 Answers  


how to show all tables with 'mysql'? : Sql dba

0 Answers  


What does the file extension accdb stand for?

0 Answers  


Categories