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

Answer Posted / veera

SELECT * FROM EMP A WHERE &N-1=(SELECT COUNT(DISTINCT SAL) FROM EMP B WHERE A.SAL<B.SAL) ORDER BY SAL

Pass Paramenter :2..it will give the 2nd maximum salary

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

what is blob? : Sql dba

564


Table A Table B 1 1 2 1 3 1. Union & union all --> A Union B , A Union all B 2. Minus , Intersect --> A minus B , B Minus A , A Intersect B 3. Joins A join B , A Left Join B A Right Join B , A full Join B 4. %Type - Uses & Benifit 5. Truncate & Delete 6. Pragma Autonomus Transaction 7. how to Perform DDL from function or procedure 8. Can we have DML inside Function 9. Rank & Dense Rank diffrence 10. Water Mark in Oracle 11. Index , Can we have index in all column of table if no then why ?

538


what is myisam? : Sql dba

578


How do I order columns in sql?

533


Can we use join in subquery?

569






How many types of tables are there?

509


Why is a trigger used?

531


what is datawarehouse? : Sql dba

573


What is a temporal data type?

599


Why do we need a foreign key?

553


How do you go back in sql?

535


What is procedure and function in sql?

536


Does a join table need a primary key?

534


what is primary key? : Sql dba

512


What is sql profiler in oracle?

568