How to Select second Maximum salary in a Table ?
Answers were Sorted based on User's Feedback
Answer / guest
select max(sal) from Table
where sal not in(select max(sal) from Table);
| Is This Answer Correct ? | 20 Yes | 3 No |
Answer / tanuj tewari
select max(sal) from table_name where sal<(select max(sal)
from table_name);
| Is This Answer Correct ? | 15 Yes | 3 No |
Answer / abhijit
select max(sal) from table_name where
sal<(select max(sal) from table_name);
or
select sal from(select sal,dense_rank() over(order by sal
desc)
as rnk from table_name) where rnk=2;
| Is This Answer Correct ? | 3 Yes | 1 No |
Answer / ranjini
select max(salary) from employee not exists (select
max(salary)from employee)
| Is This Answer Correct ? | 0 Yes | 1 No |
Answer / arpit sachan
select min(Emp_Sal)from Employee_Test where Emp_sal in(select distinct top(2) Emp_Sal from Employee_Test order by Emp_Sal desc)
| Is This Answer Correct ? | 0 Yes | 1 No |
Answer / ranjith
select salary from table order by salaray desc limit 1,1
| Is This Answer Correct ? | 0 Yes | 1 No |
Answer / kuldeep singh
select max(sal) from emp where sal not in (select top2 sal from emp order by sal desc)
| Is This Answer Correct ? | 1 Yes | 3 No |
Answer / sephali
select sal, rownum
from (select sal from table
order by sal desc)
where rownum=2
| Is This Answer Correct ? | 0 Yes | 2 No |
What is difference between truncate and delete?
What are the composite date types in oracle?
You have 4 instances running on the same UNIX box. How can you determine which shared memory and semaphores are associated with which instance?
What is a cognitive schema?
If a parameter is used in a query without being previously defined, what diff. exist betw. report 2.0 and 2.5 when the query is applied ?
How can I create database in oracle?
What SQL query from v$session can you run to show how many sessions are logged in as a particular user account?
you are a universe designer and report developer in BO, what type of information you gather from client?Briefly explain plz
Difference between sub query and nested query ?
19 Answers Keane India Ltd, TCS,
What is the difference between alert log file and trace file ?
What is the effect of setting the value of OPTIMIZER_MODE to 'RULE' ?
What would you use to improve performance on an insert statement that places millions of rows into that table?