Query for second maximum salary in each in each department

Answer Posted / swaraj

Select Department,Max(Salary)
From (Select E1.Department,E1.Salary
From Employee E1,(Select Department,Max(Salary) as Salary
From Employee group by Department) E2
Where E1.Department = E2.Department
And E1.Salary<E2.Salary) E
Group by Department

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are sql constraints?

560


Can we join more than 2 tables in sql?

483


what are the limitations of mysql in comparison of oracle? Mysql vs. Oracle. : Sql dba

537


What are the types of functions in sql?

558


What is materialized view. What are different methods of refresh?

775






Determine if oracle date is on a weekend?

548


Under what condition it is possible to have a page level lock and row lock at the same time for a query? : Transact sql

525


What is the plv (pl/vision) package offers?

605


How can check sql version from command line?

525


How many sectors are in a partition?

550


What are aggregate functions in sql?

619


What are the main features of cursor?

617


Does sql between include endpoints?

550


Is primary key clustered index?

512


How many types of index are there?

540