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 does seeding a database mean?
What is primary key and foreign key?
how a reference cursor works?what all adnvantages are gained with it..specify the situation?
How many subqueries can be nested in a statement?
What is the difference between a query and a report?
What is differance unique key and primary key.
Is record in pl sql?
Explain how to use transactions efficiently : transact sql
what are the differences between public, private, protected, static, transient, final and volatile? : Sql dba
what's the difference between a primary key and a unique key? : Sql dba
Is sql dba a good career? : SQL DBA
how is exception handling handled in mysql? : Sql dba
Oracle (3253)
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)