Query for second maximum salary in each in each department

Answer Posted / swas

SELECT *
FROM
    (
     SELECT e1.*,
     DENSE_RANK() OVER(PARTITION BY Deptno
                ORDER BY Sal DESC
                )TopRank
     FROM Emp e1
     )
WHERE TopRank = 2 
/

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 'mysqldump'? : Sql dba

573


What is mutating error?

511


Explain isolation levels. : Transact sql

579


What are the types of index in sql?

539


Can we have two clustered index on a table?

568






What is a composite primary key?

587


Why do we use subquery?

491


how to create a new table by selecting rows from another table in mysql? : Sql dba

565


How would you convert date into julian date format?

595


How can you load multi line records? : aql loader

663


What are user defined functions?

586


What is numeric function sql?

545


What are inbuilt functions in sql?

605


How to write pl sql program in mysql command prompt?

521


Mention what is the function that is used to transfer a pl/sql table log to a database table?

486