how to find the second highest salary from emp table?
Answer Posted / neil
select * from (select sal,deptno from emp a where
sal in (select distinct(b.sal) from emp b
where a.deptno=b.deptno and rownum<4)
order by deptno,sal desc )
minus
select * from (select sal,deptno from emp a where
sal in (select distinct(b.sal) from emp b
where a.deptno=b.deptno and rownum<3)
order by deptno,sal desc )
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
What is difference between mysql and postgresql?
What does trigger mean in psychology?
Does mysql support pl sql?
What is the need of a partition key?
What is the difference between partition and index?
What are the advantages of pl sql?
Which is better join or inner query?
What is a primary key called that is made up of more than one field?
What are different types of tables in sql?
Does truncate need commit?
What is cascade in sql?
Can we call a function containing dml statements in a select query?
How to create an array in pl/sql?
what tools available for managing mysql server? : Sql dba
What is a table partition?