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 |
Can we rename a column in the output of sql query?
what is difference b/w pravite procedures and public procedures?
3 Answers Steria, Wipro, Zensar,
Can we debug stored procedure?
Which type of cursor is used to execute the dml statement?
What is difference between inner join and cross join?
what is the different between now() and current_date()? : Sql dba
What is compiled query?
What are three advantages to using sql?
Is merge a dml statement?
Can you sum a count in sql?
how to connect oracle in unix prompt?
Easy way to convert tableau "IF - ELSEIF" statements to Netezza "CASE" statements.
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)