Write a query to get 2nd maximum salary in an employee table ?

Answer Posted / priya

select rownum,empno,sal from (select
rownum,empno,sal from emp order by sal desc) group
by rownum,empno,sal having rownum=2;


This will clearly work.............

Is This Answer Correct ?    6 Yes 3 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How do I view stored procedures?

555


what is a foreign key ? : Sql dba

620


What is minus?

561


What is a subquery in sql?

519


Can we write dml inside a function in sql server?

509






Is pl sql better than sql?

564


How can I speed up sql query?

536


Why is stored procedure faster than query?

502


What does count (*) mean in sql?

1108


What packages(if any) has oracle provided for use by developers?

5043


What do we need to check in database testing?

565


What are different clauses used in sql?

601


What is the difference between union and union all command?

565


a table has 2 classifications 1)liabilities 2)earnings this liabitity has 2 elements with 2 input values and the earnings have 2 elements with 2 input values i wrote a query so that my input is liability savings amount1 amount2 xxxx null xxxxxx 0 xxx1 null xxxxx1 0 null yyyy 0 yyyy null yyy1 0 yyy1 my problem is --when i developed a report(d2k) with this data my o/p is liabilities,amount1,savings,amount2 xxxx xxxxxx xxx1 xxxxx1 yyyy yyyy yyy1 yyy1 how could i move this savings,savings values 2 palces up. can any body provide me witha better solution

1788


What are the sql commands?

619