how to findout the 100th maximum salary

Answers were Sorted based on User's Feedback



how to findout the 100th maximum salary..

Answer / suresh

select sal from emp e
where 100=(select count( distinct sal) from emp where
e.sal<=sal)

Is This Answer Correct ?    10 Yes 0 No

how to findout the 100th maximum salary..

Answer / g.sivanagaraju

SELECT DISTINCT(A.SAL)
FROM EMP A
WHERE &N=(SELECT COUNT(DISTINCT(B.SAL))
FROM EMP B
WHERE A.SAL<=B.SAL);

Is This Answer Correct ?    2 Yes 0 No

how to findout the 100th maximum salary..

Answer / sanjay kumar

Select * from
(select distinct salary, dense_rank()over (Order by salary desc) rk from emp)
Where rk=100;

Is This Answer Correct ?    2 Yes 0 No

how to findout the 100th maximum salary..

Answer / cuong nguyen

select min(salary) from (select top 100 distinct salary from
emp order by salary desc)

Is This Answer Correct ?    3 Yes 2 No

how to findout the 100th maximum salary..

Answer / srinu

Hi Jyothi,

The below q uery is suitable for Nth max salary....

SELECT a.sal
FROM emp a
WHERE &N=(SELECT COUNT(DISTINCT b.sal)
FROM emp b
WHERE a.sal<=b.sal);
In the above query u can substitute any value like 1,2,..100 etc instead of &n.

Is This Answer Correct ?    1 Yes 0 No

how to findout the 100th maximum salary..

Answer / aswini

select min(sal) from (select sal from emp order by sal desc) where rownum<=100

Is This Answer Correct ?    1 Yes 0 No

how to findout the 100th maximum salary..

Answer / john bershan

select sgp from (select sgp,dense_rank() over (order by
sgp desc) as rownumber from t_policy_general)
where rownumber = '100';

Is This Answer Correct ?    1 Yes 0 No

how to findout the 100th maximum salary..

Answer / murali

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

Is This Answer Correct ?    6 Yes 6 No

how to findout the 100th maximum salary..

Answer / gani

SELECT sal FROM table_name
ORDER BY sal DESC
LIMIT(99,1);

Is This Answer Correct ?    1 Yes 1 No

how to findout the 100th maximum salary..

Answer / maroju naveen

select level,max(sal) from emp where level=&levelno
connect by prior sal>sal
group by level;
This is Nth max(sal) query.....

Is This Answer Correct ?    2 Yes 2 No

Post New Answer

More SQL PLSQL Interview Questions

ERROR:Insert or update on table"accnt" violates foreign key constraints "acct_to_curr_symbol" DETAILS:KEY(accnt_curr_id)(-2)is not present in the table "curr_symbol" ......solve The Problem..

0 Answers   Wipro,


Can we use join in subquery?

0 Answers  


What is mutating trigger?

0 Answers  


What are the components of a PL/SQL block ?

3 Answers  


What is database white box testing and black box testing?

0 Answers  






What are different types of functions in sql?

0 Answers  


What is a Mapplet?

0 Answers   Informatica,


List and explain the different types of join clauses supported in ansi-standard sql?

0 Answers  


If we update a complex view, is base table will get update ?

2 Answers   Ardee Technologies, HCL,


what is subquery? : Sql dba

0 Answers  


I need a function for a train ticket reservation please answer it thanks in advance

0 Answers  


What is the difference between UNIQUE CONSTRAINT and PRIMARY KEY? 1. There is no difference. 2. A PRIMARY KEY cannot be declared on multiple columns. 3. A UNIQUE CONSTRAINT cannot be declared on multiple columns. 4. A table can have multiple PRIMARY KEYS but only one UNIQUE CONSTRAINT. 5. A table can have multiple UNIQUE CONSTRAINTs but only one PRIMARY KEY.

7 Answers   Satyam,


Categories