Query for second maximum salary in each in each department

Answer Posted / akula

select * from emp e1 where 2 =(select count(distinct(sal)) from emp e2 where e1.dno=e2.dno and e1.sal<=e2.sal);

Is This Answer Correct ?    1 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Which normal form is best?

513


How do you update a sql procedure?

521


What is the cause of mutating table error and how can we solve it?

598


What is triggering circuit?

593


What are the sql aggregate functions?

604






How do I order by ascending in sql?

538


Are null values same as that of zero or a blank space?

531


What is user in sql?

577


Is sql considered coding?

567


What is varchar example?

574


Does sql use python?

560


What is a stored procedure in sql with example?

601


What is the difference between partition and index?

482


How do I remove duplicates in two columns?

508


What is AUTH_ID and AUTH_USER in pl/sql ?

1690