Query for second maximum salary in each in each department

Answer Posted / ram

SELECT empno,salary,dept_id FROM (SELECT empno,salary,dept_id,DENSE_RANK() OVER (PARTITION BY Dept_id ORDER BY Salary DESC)
as Rnk FROM emp) WHERE Rnk = 2;

Is This Answer Correct ?    8 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

List and explain the different types of join clauses supported in ansi-standard sql?

814


Explain what is a view?

598


How many sql commands are there?

673


What is sql key?

516


How can we avoid duplicating records in a query?

562






what are all different types of collation sensitivity? : Sql dba

523


Can you selectively load only those records that you need? : aql loader

611


What is an invalid partition table?

564


What does := mean in pl sql?

553


Is pl sql a programming language?

546


what are the different type of normalization? : Sql dba

554


Which sorts rows in sql?

585


ERROR:Insert or update on table"accnt" violates foreign key constraints "acct_to_curr_symbol" DETAILS:KEY(accnt_curr_id)(-2)is not present in the table "curr_symbol" ......solve The Problem..

2004


Does sqlite need a server?

539


what is the difference between inner and outer join? Explain with example. : Sql dba

546