Query for second maximum salary in each in each department

Answer Posted / gopinath

select department_id, salary from
(select department_id, salary, rank() over(partition by
department_id order by salary desc) r from employees) where r=2;



cheers;

Is This Answer Correct ?    35 Yes 13 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is dba in sql? : SQL DBA

541


What are all the ddl commands?

638


List the different type of joins?

575


What is online transaction processing (oltp)?

605


What has stored procedures in sql?

605






What sql does db2 use?

549


How to handle bulk data?

896


what are the advantages of sql ? : Sql dba

552


What is the difference between in and between in sql?

578


What are the events on which a database trigger can be based?

600


How to fix oracle error ora-00942: table or view does not exist

577


What are the subsets of sql?

553


Why select is used in sql?

522


What is sql and its types?

628


What is %rowtype in pl sql?

519