how to findout the 100th maximum salary
Answers were Sorted based on User's Feedback
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 |
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 |
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 |
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 |
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 |
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 |
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 |
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 |
Answer / gani
SELECT sal FROM table_name
ORDER BY sal DESC
LIMIT(99,1);
| Is This Answer Correct ? | 1 Yes | 1 No |
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 |
Is drop table faster than truncate?
What does subquery mean in sql?
Write a sql query to get the third highest salary of an employee from employee_table?
What is oracle and pl sql?
How many levels can subqueries be nested in a FROM clause?
What is insert command in sql?
explain advantages of innodb over myisam. : Sql dba
hi,i plan to put experience on PLSQL ,can anyone suggest me for any institutes in bangalore or how to prepare for interviews
What are different types of statements supported by sql?
there is A table and B table in A table there 5 rows and in b table there are 2 rows i am firing query select * from a,b what will be the output?
While inserting/updating million of records into a database table, how do I came to know how many records has been inserted or updated successfully so far?
write the Sql query for creating database backup?
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)