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 are packages in pl sql and also explain its advantages?
What is plpgsql language?
What does bitemporal mean?
What is sql query optimization?
How to run sql commands in sql*plus?
What are the basic techniques of indexing?
What is a table in a database?
explain the delete statements in sql
What is the difference between in and between in sql?
Is inner join same as self join?
What is an inconsistent dependency?
Can we create view in stored procedure?
How do you update a sql procedure?
What is nested table in pl sql?
What is break?