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 data profiling in sql?

509


What is the use of double ampersand (&&) in sql queries? Give an example

602


what is bcp? When does it used? : Sql dba

511


Is sqlite thread safe?

596


Is trigger a stored procedure?

498






What is difference between sql function and stored procedure?

501


What is the use of partition by in sql?

508


Inline the values in PL/SQL, what does it mean.?

621


What are triggers and its types?

547


what are the non-standard sql commands supported by 'mysql'? : Sql dba

569


If a cursor is open, how can we find in a pl/sql block?

667


What is the maximum size of sqlite database?

542


What is clustered index in sql?

582


Does user triggers have entry for trigger with compilation errors?

586


What are the two types of exceptions.

629