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 |
I have query like this. select dept_id, max_mark from stude_dept where min_mark= (select min(mini_mark) from stud_dept); How can i optimize this query. Can anyone help me with it
WHAT IS THE DIFFERENCE BETWEEN PRIMARY KEY(PK) CONSTRAINT AND UNIQUE KEY(UK) + NOT NULL(NN) CONSTRAINT ASSIGN TO A COLUMN ? INSTEAD OF ASSIGNING PK ,WE CAN ASSIGN UK + NN TO A COLUMN. WHAT ARE THE MARRITS AND DEMARITS BETWEEN THE ABOVE TWO?THE ABOVE TWO ARE SAME,THEY DON'T ALLOW DUPLICATE AS WELL AS NULL VALUES.
i have a table with the columns below as Emp_ID Address_ID Address_Line City Country -------- --------- ----------- ------ --------- Q: Display the Emp_ID's those having more than one Address_ID
What are the differences between char and nchar in oracle?
How to Select second Maximum salary in a Table ?
what is the bitmap index?
What are joins, explain all types of joins?
Which is better Oracle or MS SQL? Why?
what is the syntax of UPDATE command?
What is a dynamic performance view in oracle?
How to assign query results to variables?
What is the function of Redo Log ?