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 a table called, if it has neither cluster nor non-cluster index? What is it used for? : Sql dba

522


What is a boolean in sql?

520


What is sql*loader?

572


How do I view a sql database?

556


what are the advantages of mysql in comparison to oracle? : Sql dba

525






how to use in conditions? : Sql dba

512


Are there any features that are decommissioned in 11g that are not present in 11g?

1593


What is a ddl command?

532


What is difference between nchar and nvarchar?

540


What is using in sql?

562


What is a sql*loader control file?

617


What is sqlservr exe?

478


How do I find duplicates in the same column?

543


What is sql partition function?

614


What is the use of sqlerrd 3?

519