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 |
What is the difference between the conventional and direct path loads? : aql loader
What is the sql*loader? : aql loader
Does indexing improve query performance?
Which is better join or subquery?
What is compilation error in pl sql?
What is the difference between a subquery and a join?
How you improve the performance of sql*loader? : aql loader
What is sql stand for?
how to see the oracle 9i/10g table in pc? or In my pc where the table is saved and how to see?
how to calculate expressions with sql statements? : Sql dba
how does a local variable is defined using t-sql? : Transact sql
What is the difference between microsoft access and sql server?
Oracle (3259)
SQL Server (4518)
MS Access (429)
MySQL (1402)
Postgre (483)
Sybase (267)
DB Architecture (141)
DB Administration (291)
DB Development (113)
SQL PLSQL (3330)
MongoDB (502)
IBM Informix (50)
Neo4j (82)
InfluxDB (0)
Apache CouchDB (44)
Firebird (5)
Database Management (1411)
Databases AllOther (288)