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

What is the data pump export utility?

0 Answers  


what are pseudocolumns?

4 Answers  


Define Normalization with example?

1 Answers  


What is a read write transaction in oracle?

0 Answers  


How do I connect to oracle database?

0 Answers  






Can you tell me how to add new column in existing views?how?How is possible?

0 Answers   FIS,


Query to get max and second max in oracle in one query ?

34 Answers   CTS, Keane India Ltd, TCS, Wipro,


interview questions with answer for cts

0 Answers   Cognizant,


How to convert a date to char in oracle? Give one example.

0 Answers  


How to retrieve 5th highest sal from emp table?

8 Answers  


What is a dead lock in oracle?

0 Answers  


create or replace procedure show_tab_rec ( P_tab VARCHAR2 ) IS cmd varchar2(50); begin cmd := 'select * from '|| P_tab; for int in ( execute immediate cmd ) loop dbms_output.put_line ( int.ename||' '||int.deptno); end loop; end; when i m compling this procedure i m getting this error PLS-00103: Encountered the symbol "IMMEDIATE" when expecting one of the following: . ( ) , * @ % & | = - + < / > at in is mod remainder not range rem => .. <an exponent (**)> <> or != or ~= >= <= <> and or like LIKE2_ LIKE4_ LIKEC_ between || multiset member SUBMULTISET_ PLZ solve this error give this question answer asap Thanks advance.......

1 Answers   HCL,


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)