how to find the second highest salary in a given table????
Answers were Sorted based on User's Feedback
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 |
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 |
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 |
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 |
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 |
What is the data pump export utility?
what are pseudocolumns?
Define Normalization with example?
What is a read write transaction in oracle?
How do I connect to oracle database?
Can you tell me how to add new column in existing views?how?How is possible?
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
How to convert a date to char in oracle? Give one example.
How to retrieve 5th highest sal from emp table?
What is a dead lock in oracle?
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.......