how to findout the 100th maximum salary
Answers were Sorted based on User's Feedback
Answer / sajid siddiki
SELECT DISTINCT (a.sal) FROM EMP A WHERE &N = (SELECT COUNT
(DISTINCT (b.sal)) FROM EMP B WHERE a.sal < = b.sal);
For Eg:-
Enter value for n: 100
SAL
---------
3700
| Is This Answer Correct ? | 0 Yes | 0 No |
Answer / g sivanagaraju
SELECT sal
FROM emp e
WHERE &100=(SELECT COUNT(DISTINCT(SAL))
FROM emp
WHERE e.sal<=sal);
| Is This Answer Correct ? | 0 Yes | 0 No |
Answer / swastik
SELECT LEVEL, MAX(Sal)
FROM Emp
GROUP BY LEVEL
HAVING LEVEL = &GiveNo
CONNECT BY PRIOR Sal > Sal;
| Is This Answer Correct ? | 0 Yes | 0 No |
Answer / ram
select * from emp
where sal in(select max(sal) from emp
where level=&nth
connect by prior sal>sal
group by level)order by sal
| Is This Answer Correct ? | 0 Yes | 0 No |
Answer / siva prasad
SELECT B.* FROM
(SELECT A.*,DENSE_RANK() OVER(ORDER BY SAL DESC) V_SAL
FROM EMP A )B
WHERE V_SAL = 100
| Is This Answer Correct ? | 0 Yes | 0 No |
Answer / parul verma
select min(salary) from (select distinct salary from emp
where salary is not null order by salary desc) where rownum
<=100;
| Is This Answer Correct ? | 0 Yes | 1 No |
Answer / lince
select sal from
(
select row_number() over (order by sal desc) as rno,sal
from Emp
)T
where T.rno=100
| Is This Answer Correct ? | 0 Yes | 2 No |
Answer / raghuvir
select min(sal) from empl where romwnum < = 100 order by
sal desc
| Is This Answer Correct ? | 1 Yes | 4 No |
Answer / akki reddy
SELECT *
(SELECT SAL, ROWNUM RN FROM EMP ORDER BY SAL DESC)
WHERE RN=100;
| Is This Answer Correct ? | 0 Yes | 3 No |
Answer / katasani rajesh reddy
select salary from(select salary from
order by salary)
where rownum<=100
minus
select salary from(select salary from
order by salary)
where rownum<=99
| Is This Answer Correct ? | 0 Yes | 3 No |
What are sql built in functions?
What is use of trigger?
What is interval partition?
What is difference between a PROCEDURE & FUNCTION ?
What is difference between CHAR and VARCHAR2?What is the maximum SIZE allowed for each type?
What is the use of count (*) in sql?
What does closing a cursor do?
Can I join the same table twice?
What is cross join sql?
what are the types of join and explain each? : Sql dba
What are the two parts of a procedure ?
What is the difference among union, minus and intersect?
Oracle (3259)
SQL Server (4518)
MS Access (429)
MySQL (1402)
Postgre (483)
Sybase (267)
DB Architecture (141)
DB Administration (291)
DB Development (113)
SQL PLSQL (3330)
MongoDB (502)
IBM Informix (50)
Neo4j (82)
InfluxDB (0)
Apache CouchDB (44)
Firebird (5)
Database Management (1411)
Databases AllOther (288)