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
How do I access sql anywhere database?
in oracle 10g sw after compiling procedure how to pass parameter values ,if we (v_empid out number)how to give empid after successful compilation program.This site exact suitable for 10g with respect to question & answer same format , im trying sql browser & sql command prompt using exec procedure name & respective parameters.
How to assign sql query results to pl sql variables?
How can you save or place your msg in a table?
How do you select unique values in sql?
How can the performance of a trigger be improved?
What is left join in postgresql?
What is the difference between cross join and natural join?
What is column?
What is the use of index in sql?
What is the maximum number of columns in sql table?
What are stored procedures used for?
What are schema-level triggers?
What is serial sql?
what are the join types in tsql? : Transact sql