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

i have a table with column sno with 30 records. i want to update this column by item by item in asp.net. i wantto enter new values into that from 1 to 30 how is it possible with backend c#

1 Answers  


what is the difference between ereg_replace() and eregi_replace()? : Sql dba

0 Answers  


What are data types in pl sql?

0 Answers  


how to create a table index in mysql? : Sql dba

0 Answers  


What are actual parameters and formal parameters?

0 Answers  






what are wild cards used in database for pattern matching ? : Sql dba

0 Answers  


what are the different tables present in mysql? : Sql dba

0 Answers  


What is the difference between having clause and where clause?

0 Answers  


What is the most common sql injection tool?

0 Answers  


i have a table t1 a math 20 b phy 30 cchemisty 10 a math 40 b phy 23 c che 21 a math15 bphy 33 c che 56 write a quire to find out the max markr of each subject

8 Answers  


Is it mandatory for the primary key to be given a value when a new record is inserted?

0 Answers  


Is natural join same as inner join?

0 Answers  


Categories