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 |
How will you differentiate between varchar & varchar2?
Can any one explain me when i execute below query.. select months_between('07-JUL-12','10-FEB-12') from dual; Out put:- 4.90322581 How oracle calculate?
Differentiate the standard purchase order,Blanket purchase agreement,Contract purchase agreement,Planned purchase order?
Explain the use of record length option in exp command.
Can a field be used in a report without it appearing in any data group ?
What is a sub query? Describe its types?
How do I decide when to use right joins/left joins or inner joins or how to determine which table is on which side?
Tab A A B ------ 1 A 2 B 3 C Tab B A B ----- 4 D 5 E 6 F Generate the value into B table from A table. Only table A has the value. Write the SQL query to get B table value.
What is Redo Log Buffer in Oracle?
How to bring a tablespace offline?
How many types of tables supported by oracle?
Explain the use of grant option in imp command.