Query for second maximum salary in each in each department
Answers were Sorted based on User's Feedback
Answer / jairam
select deptno,Max(e1.sal) from emp e1
where e1.sal NOT IN(select Max(e2.sal) from emp e2
group by e2.deptno)group by e1.deptno
Is This Answer Correct ? | 0 Yes | 3 No |
Answer / nancy singhal
select max(salary) from emp where salary in(select salary
from emp where salary not in(select max(salary) from emp));
Is This Answer Correct ? | 0 Yes | 3 No |
Answer / sravan
Select first_name, salary, rownum rank from
(select *from emp order by salary desc)
Is This Answer Correct ? | 0 Yes | 5 No |
Answer / sampath pallerla
select distinct(a.sal) from emp a where 2=(select count(distinct(b.sal)) from emp b where a.sal<=b.sal);
Is This Answer Correct ? | 1 Yes | 7 No |
Answer / yaswanth
select salary from(select salary,rownum rk from(select salary from employees order by salary desc)) ehere rk=2;
Is This Answer Correct ? | 2 Yes | 13 No |
How does postgresql compare to "nosql"?
what are the differences among rownum, rank and dense_rank? : Sql dba
Should I use mbr or gpt?
what is a database lock ? : Sql dba
What are inbuilt functions in sql?
mention if it is possible to import data directly from t-sql commands without using sql server integration services? If yes, what are the commands? : Transact sql
Sql technical questions
How do you rename a table in sql?
Is json a nosql?
What are the ddl commands?
- Types of triggers - View - Dcl - Procedures, packages, functions - Metasolve - Can use Dcl in triggers - package case study - Cursor and its types - triggers schedule - Wrap - Why we are using fetch and for in cursor. difference?
what is the output of this query selet * from employee where 1=2 ??