how to find the second highest salary in a given table????

Answers were Sorted based on User's Feedback



how to find the second highest salary in a given table????..

Answer / kedar

select max(salary) from employees where salary < (select
max(salary) from employees);


the max salary is 24000
& second max is 17000
chwck out

Is This Answer Correct ?    8 Yes 0 No

how to find the second highest salary in a given table????..

Answer / shahnaz

To find the 2nd highest salary from emp table:

select max(sal) from emp where sal not in (select max(sal)
from emp )

Is This Answer Correct ?    3 Yes 2 No

how to find the second highest salary in a given table????..

Answer / manikandan. s

This is the nth max

SELECT salary
FROM (SELECT ROWNUM sl, salary
FROM (SELECT salary
FROM employees
GROUP BY salary
ORDER BY salary))
WHERE sl = n

Is This Answer Correct ?    1 Yes 1 No

how to find the second highest salary in a given table????..

Answer / mahesh

SELECT *
FROM (SELECT ROWNUM sl, salary
FROM (SELECT DISTINCT salary
FROM employees
ORDER BY salary))
WHERE sl = n

Is This Answer Correct ?    0 Yes 0 No

how to find the second highest salary in a given table????..

Answer / ajit nayak

SELECT MAX( Sal ), LEVEL
FROM Emp
WHERE LEVEl = &Givelevelno
CONNECT BY PRIOR Sal > Sal
GROUP BY LEVEL;

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More Oracle General Interview Questions

Table1- have two column filename data AFGDFD-20112011 hi how r u bsdasd-23042011 name shoud be in bold Now i want output like filename data AFGDFD hi how r u bsdasd name shoud be in bold Kindly answer this

3 Answers   HCL,


How to get execution statistics reports on query statements?

0 Answers  


What is a snapshot in oracle database?

0 Answers  


Can anyone give me information about oracle certification

1 Answers  


What is a Data Dictionary ?

5 Answers  






What is the best way to do multi-row insert in oracle?

0 Answers  


Difference between cartesian join and cross join?

0 Answers  


what is cartesian product?

2 Answers  


What is the difference between a vector and an Array? (Java)

3 Answers   RBS,


There are three tables : E : EID,ENAME D : DID,DNAME empdept : eid, did select the employees who doesn't belong to any dep

4 Answers   Microsoft,


how can db_files > maxdatafiles since db_files is for instance and the later is for database

0 Answers   CTS,


What is oracle server autotrace in oracle?

0 Answers  


Categories
  • Oracle General Interview Questions Oracle General (1789)
  • Oracle DBA (Database Administration) Interview Questions Oracle DBA (Database Administration) (261)
  • Oracle Call Interface (OCI) Interview Questions Oracle Call Interface (OCI) (10)
  • Oracle Architecture Interview Questions Oracle Architecture (90)
  • Oracle Security Interview Questions Oracle Security (38)
  • Oracle Forms Reports Interview Questions Oracle Forms Reports (510)
  • Oracle Data Integrator (ODI) Interview Questions Oracle Data Integrator (ODI) (120)
  • Oracle ETL Interview Questions Oracle ETL (15)
  • Oracle RAC Interview Questions Oracle RAC (93)
  • Oracle D2K Interview Questions Oracle D2K (72)
  • Oracle AllOther Interview Questions Oracle AllOther (241)